Esempio n. 1
0
 public unsafe static void serialize(int value, XSteam steam)
 {
     steam.applySize(size);
     fixed(byte *ptr = steam.contents[steam.index_group])
     {
         *(int *)(ptr + steam.index_cell) = BitConverter.IsLittleEndian ? value : (int)utils.toLittleEndian((uint)value);
         steam.index_cell += size;
     }
 }
        public unsafe static void serialize(string value, XSteam steam)
        {
            var bytes = Encoding.UTF8.GetBytes(value);

            uintBuffer.serialize((uint)bytes.Length, steam);
            for (int i = 0; i < bytes.Length; i++)
            {
                steam.applySize(1);
                steam.contents[steam.index_group][steam.index_cell] = bytes[i];
                steam.index_cell += 1;
            }
        }
Esempio n. 3
0
 public unsafe static void serialize(float value, XSteam steam)
 {
     //boolBuffer.serialize(value == defaultValue, steam);
     //if (value != defaultValue)
     {
         steam.applySize(size);
         fixed(byte *ptr = steam.contents[steam.index_group])
         {
             *(float *)(ptr + steam.index_cell) = BitConverter.IsLittleEndian ? value : utils.toLittleEndian((uint)value);
             steam.index_cell += size;
         }
     }
 }