Exemple #1
0
 public static unsafe int DoubleToUnicode(double value, char[] chars, int offset, int precision)
 {
     fixed(char *charptr = chars)
     {
         return(CharConverter.DoubleToUnicode(value, charptr, chars.Length, offset, precision));
     }
 }
Exemple #2
0
 public static unsafe int UlongToUnicode(ulong value, char[] chars, int offset)
 {
     fixed(char *charptr = chars)
     {
         return(CharConverter.UlongToUnicode(value, charptr, chars.Length, offset));
     }
 }
Exemple #3
0
 public unsafe static int DoubleToUnicode(double value, Span <char> chars, int precision)
 {
     fixed(char *ptr = chars)
     {
         return(CharConverter.DoubleToUnicode(value, ptr, chars.Length, 0, precision));
     }
 }
Exemple #4
0
 public static int UintToUnicode(uint value, Span <char> chars)
 {
     unsafe
     {
         fixed(char *ptr = chars)
         {
             return(CharConverter.UintToUnicode(value, ptr, chars.Length, 0));
         }
     }
 }
Exemple #5
0
        public static unsafe int LongToUnicode(long value, char *chars, int length, int offset)
        {
            if (value < 0)
            {
                int written = CharConverter.UlongToUnicode((ulong)-value, chars, length, offset + 1);

                // Add the minus afterwards to avoid modifying the char array incase of out of bounds.
                chars[offset] = '-';
                return(++written);
            }
            else
            {
                return(CharConverter.UlongToUnicode((ulong)value, chars, length, offset));
            }
        }
Exemple #6
0
        public static int IntToUnicode(int value, char[] chars, int offset)
        {
            if (value < 0)
            {
                int written = CharConverter.UintToUnicode((uint)-value, chars, offset + 1);

                // Add the minus afterwards to avoid modifying the char array incase of out of bounds.
                chars[offset] = '-';
                return(++written);
            }
            else
            {
                return(CharConverter.UintToUnicode((uint)value, chars, offset));
            }
        }
Exemple #7
0
 public static unsafe int FloatToUnicode(float value, char *chars, int length, int offset, int precision)
 => CharConverter.DoubleToUnicode(value, chars, length, offset, precision);
Exemple #8
0
 public static int FloatToUnicode(float value, char[] chars, int offset, int precision)
 => CharConverter.DoubleToUnicode(value, chars, offset, precision);
Exemple #9
0
 public static int FloatToUnicode(float value, Span <char> chars, int precision)
 => CharConverter.DoubleToUnicode(value, chars, precision);
        public static void WriteInt(this IWriteBuffer <char> buffer, int value)
        {
            Span <char> valueBuffer = stackalloc char[20];
            var         written     = CharConverter.IntToUnicode(value, valueBuffer);

            buffer.Write(valueBuffer[0..written]);