Exemplo n.º 1
0
        public unsafe string GuidToString(ref Guid value)
        {
            var str    = AsciiInterface.FastAllocateString(32);
            var vector = GuidToUtf8_32(in Unsafe.As <Guid, Vector128 <byte> >(ref value)).AsByte();

            AsciiInterface.AsciiToUnicode(vector, ref AsciiInterface.StringTo <char, Vector256 <short> >(str));
            return(str);
        }
Exemplo n.º 2
0
        public unsafe string DateTimeToString(DateTime value)
        {
            var str = AsciiInterface.FastAllocateString(19);
            var r   = DateTimeToUtf8_19(value);

            Set38(Avx2.ConvertToVector256Int16(Avx2.ExtractVector128(r, 0)), Avx2.ConvertToVector256Int16(Avx2.ExtractVector128(r, 1)), ref Unsafe.AsRef(in str.GetPinnableReference()));
            return(str);
        }
Exemplo n.º 3
0
        public unsafe string LongToString(long value)
        {
            var str    = AsciiInterface.FastAllocateString(16);
            var vector = Avx2.ConvertToVector256Int16(LongToUtf8_16(value));

            Unsafe.As <char, Vector256 <short> >(ref Unsafe.AsRef(in str.GetPinnableReference())) = vector;
            return(str);
        }
Exemplo n.º 4
0
        public unsafe string IntToString(int value)
        {
            var str    = AsciiInterface.FastAllocateString(8);
            var vector = IntToUtf8_8(value);

            Unsafe.As <char, Vector128 <short> >(ref Unsafe.AsRef(in str.GetPinnableReference())) = Sse41.ConvertToVector128Int16((byte *)&vector);
            return(str);
        }
Exemplo n.º 5
0
        public unsafe string BytesToString(byte[] value, bool prefix = false)
        {
#if NET6_0_OR_GREATER
            ArgumentNullException.ThrowIfNull(value);
#else
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
#endif
            var      str     = AsciiInterface.FastAllocateString(value.Length * 2 + (prefix ? 2 : 0));
            ref char strSite = ref Unsafe.AsRef(in str.GetPinnableReference());