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)); } }
public static unsafe int UlongToUnicode(ulong value, char[] chars, int offset) { fixed(char *charptr = chars) { return(CharConverter.UlongToUnicode(value, charptr, chars.Length, offset)); } }
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)); } }
public static int UintToUnicode(uint value, Span <char> chars) { unsafe { fixed(char *ptr = chars) { return(CharConverter.UintToUnicode(value, ptr, chars.Length, 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)); } }
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)); } }
public static unsafe int FloatToUnicode(float value, char *chars, int length, int offset, int precision) => CharConverter.DoubleToUnicode(value, chars, length, offset, precision);
public static int FloatToUnicode(float value, char[] chars, int offset, int precision) => CharConverter.DoubleToUnicode(value, chars, offset, precision);
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]);