Lines Matching full:offset
99 protected void WriteLittleEndian(int offset, int count, ulong data) in WriteLittleEndian() argument
105 _buffer[offset + i] = (byte)(data >> i * 8); in WriteLittleEndian()
112 _buffer[offset + count - 1 - i] = (byte)(data >> i * 8); in WriteLittleEndian()
117 protected ulong ReadLittleEndian(int offset, int count) in ReadLittleEndian() argument
119 AssertOffsetAndLength(offset, count); in ReadLittleEndian()
125 r |= (ulong)_buffer[offset + i] << i * 8; in ReadLittleEndian()
132 r |= (ulong)_buffer[offset + count - 1 - i] << i * 8; in ReadLittleEndian()
140 private void AssertOffsetAndLength(int offset, int length) in AssertOffsetAndLength() argument
143 if (offset < 0 || in AssertOffsetAndLength()
144 offset > _buffer.Length - length) in AssertOffsetAndLength()
149 public void PutSbyte(int offset, sbyte value) in PutSbyte() argument
151 AssertOffsetAndLength(offset, sizeof(sbyte)); in PutSbyte()
152 _buffer[offset] = (byte)value; in PutSbyte()
155 public void PutByte(int offset, byte value) in PutByte() argument
157 AssertOffsetAndLength(offset, sizeof(byte)); in PutByte()
158 _buffer[offset] = value; in PutByte()
161 public void PutByte(int offset, byte value, int count) in PutByte() argument
163 AssertOffsetAndLength(offset, sizeof(byte) * count); in PutByte()
165 _buffer[offset + i] = value; in PutByte()
169 public void Put(int offset, byte value) in Put() argument
171 PutByte(offset, value); in Put()
176 public void PutShort(int offset, short value) in PutShort() argument
178 PutUshort(offset, (ushort)value); in PutShort()
181 public unsafe void PutUshort(int offset, ushort value) in PutUshort() argument
183 AssertOffsetAndLength(offset, sizeof(ushort)); in PutUshort()
186 *(ushort*)(ptr + offset) = BitConverter.IsLittleEndian in PutUshort()
192 public void PutInt(int offset, int value) in PutInt() argument
194 PutUint(offset, (uint)value); in PutInt()
197 public unsafe void PutUint(int offset, uint value) in PutUint() argument
199 AssertOffsetAndLength(offset, sizeof(uint)); in PutUint()
202 *(uint*)(ptr + offset) = BitConverter.IsLittleEndian in PutUint()
208 public unsafe void PutLong(int offset, long value) in PutLong() argument
210 PutUlong(offset, (ulong)value); in PutLong()
213 public unsafe void PutUlong(int offset, ulong value) in PutUlong() argument
215 AssertOffsetAndLength(offset, sizeof(ulong)); in PutUlong()
218 *(ulong*)(ptr + offset) = BitConverter.IsLittleEndian in PutUlong()
224 public unsafe void PutFloat(int offset, float value) in PutFloat() argument
226 AssertOffsetAndLength(offset, sizeof(float)); in PutFloat()
231 *(float*)(ptr + offset) = value; in PutFloat()
235 *(uint*)(ptr + offset) = ReverseBytes(*(uint*)(&value)); in PutFloat()
240 public unsafe void PutDouble(int offset, double value) in PutDouble() argument
242 AssertOffsetAndLength(offset, sizeof(double)); in PutDouble()
247 *(double*)(ptr + offset) = value; in PutDouble()
252 *(ulong*)(ptr + offset) = ReverseBytes(*(ulong*)(ptr + offset)); in PutDouble()
258 public void PutShort(int offset, short value) in PutShort() argument
260 AssertOffsetAndLength(offset, sizeof(short)); in PutShort()
261 WriteLittleEndian(offset, sizeof(short), (ulong)value); in PutShort()
264 public void PutUshort(int offset, ushort value) in PutUshort() argument
266 AssertOffsetAndLength(offset, sizeof(ushort)); in PutUshort()
267 WriteLittleEndian(offset, sizeof(ushort), (ulong)value); in PutUshort()
270 public void PutInt(int offset, int value) in PutInt() argument
272 AssertOffsetAndLength(offset, sizeof(int)); in PutInt()
273 WriteLittleEndian(offset, sizeof(int), (ulong)value); in PutInt()
276 public void PutUint(int offset, uint value) in PutUint() argument
278 AssertOffsetAndLength(offset, sizeof(uint)); in PutUint()
279 WriteLittleEndian(offset, sizeof(uint), (ulong)value); in PutUint()
282 public void PutLong(int offset, long value) in PutLong() argument
284 AssertOffsetAndLength(offset, sizeof(long)); in PutLong()
285 WriteLittleEndian(offset, sizeof(long), (ulong)value); in PutLong()
288 public void PutUlong(int offset, ulong value) in PutUlong() argument
290 AssertOffsetAndLength(offset, sizeof(ulong)); in PutUlong()
291 WriteLittleEndian(offset, sizeof(ulong), value); in PutUlong()
294 public void PutFloat(int offset, float value) in PutFloat() argument
296 AssertOffsetAndLength(offset, sizeof(float)); in PutFloat()
299 WriteLittleEndian(offset, sizeof(float), (ulong)inthelper[0]); in PutFloat()
302 public void PutDouble(int offset, double value) in PutDouble() argument
304 AssertOffsetAndLength(offset, sizeof(double)); in PutDouble()
307 WriteLittleEndian(offset, sizeof(double), ulonghelper[0]); in PutDouble()
326 public short GetShort(int offset) in GetShort() argument
328 return (short)GetUshort(offset); in GetShort()
331 public unsafe ushort GetUshort(int offset) in GetUshort() argument
333 AssertOffsetAndLength(offset, sizeof(ushort)); in GetUshort()
337 ? *(ushort*)(ptr + offset) in GetUshort()
338 : ReverseBytes(*(ushort*)(ptr + offset)); in GetUshort()
342 public int GetInt(int offset) in GetInt() argument
344 return (int)GetUint(offset); in GetInt()
347 public unsafe uint GetUint(int offset) in GetUint() argument
349 AssertOffsetAndLength(offset, sizeof(uint)); in GetUint()
353 ? *(uint*)(ptr + offset) in GetUint()
354 : ReverseBytes(*(uint*)(ptr + offset)); in GetUint()
358 public long GetLong(int offset) in GetLong() argument
360 return (long)GetUlong(offset); in GetLong()
363 public unsafe ulong GetUlong(int offset) in GetUlong() argument
365 AssertOffsetAndLength(offset, sizeof(ulong)); in GetUlong()
369 ? *(ulong*)(ptr + offset) in GetUlong()
370 : ReverseBytes(*(ulong*)(ptr + offset)); in GetUlong()
374 public unsafe float GetFloat(int offset) in GetFloat() argument
376 AssertOffsetAndLength(offset, sizeof(float)); in GetFloat()
381 return *(float*)(ptr + offset); in GetFloat()
385 uint uvalue = ReverseBytes(*(uint*)(ptr + offset)); in GetFloat()
391 public unsafe double GetDouble(int offset) in GetDouble() argument
393 AssertOffsetAndLength(offset, sizeof(double)); in GetDouble()
398 return *(double*)(ptr + offset); in GetDouble()
402 ulong uvalue = ReverseBytes(*(ulong*)(ptr + offset)); in GetDouble()