Beispiel #1
0
 /// <summary>
 /// Puts a {@code int} at memory address {@code p} by writing byte for byte, instead of the whole value
 /// in one go. This can be useful, even necessary in some scenarios where <seealso cref="allowUnalignedMemoryAccess"/>
 /// is {@code false} and {@code p} isn't aligned properly. Values written with this method should be
 /// read using <seealso cref="getIntByteWiseLittleEndian(long)"/>.
 /// </summary>
 /// <param name="p"> address pointer to start writing at. </param>
 /// <param name="value"> value to write byte for byte. </param>
 public static void PutIntByteWiseLittleEndian(long p, int value)
 {
     UnsafeUtil.PutByte(p, ( sbyte )value);
     UnsafeUtil.PutByte(p + 1, ( sbyte )(value >> 8));
     UnsafeUtil.PutByte(p + 2, ( sbyte )(value >> 16));
     UnsafeUtil.PutByte(p + 3, ( sbyte )(value >> 24));
 }
Beispiel #2
0
 /// <summary>
 /// Puts a {@code long} at memory address {@code p} by writing byte for byte, instead of the whole value
 /// in one go. This can be useful, even necessary in some scenarios where <seealso cref="allowUnalignedMemoryAccess"/>
 /// is {@code false} and {@code p} isn't aligned properly. Values written with this method should be
 /// read using <seealso cref="getShortByteWiseLittleEndian(long)"/>.
 /// </summary>
 /// <param name="p"> address pointer to start writing at. </param>
 /// <param name="value"> value to write byte for byte. </param>
 public static void PutLongByteWiseLittleEndian(long p, long value)
 {
     UnsafeUtil.PutByte(p, ( sbyte )value);
     UnsafeUtil.PutByte(p + 1, ( sbyte )(value >> 8));
     UnsafeUtil.PutByte(p + 2, ( sbyte )(value >> 16));
     UnsafeUtil.PutByte(p + 3, ( sbyte )(value >> 24));
     UnsafeUtil.PutByte(p + 4, ( sbyte )(value >> 32));
     UnsafeUtil.PutByte(p + 5, ( sbyte )(value >> 40));
     UnsafeUtil.PutByte(p + 6, ( sbyte )(value >> 48));
     UnsafeUtil.PutByte(p + 7, ( sbyte )(value >> 56));
 }
Beispiel #3
0
 /// <summary>
 /// Puts a {@code short} at memory address {@code p} by writing byte for byte, instead of the whole value
 /// in one go. This can be useful, even necessary in some scenarios where <seealso cref="allowUnalignedMemoryAccess"/>
 /// is {@code false} and {@code p} isn't aligned properly. Values written with this method should be
 /// read using <seealso cref="getShortByteWiseLittleEndian(long)"/>.
 /// </summary>
 /// <param name="p"> address pointer to start writing at. </param>
 /// <param name="value"> value to write byte for byte. </param>
 public static void PutShortByteWiseLittleEndian(long p, short value)
 {
     UnsafeUtil.PutByte(p, ( sbyte )value);
     UnsafeUtil.PutByte(p + 1, ( sbyte )(value >> 8));
 }