Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Easy encoding of numbers to BigEndian, LittleEndian and Varint.

License

Notifications You must be signed in to change notification settings

tabrath/BinaryEncoding

Open more actions menu

Repository files navigation

BinaryEncoding

Travis Appveyor CircleCI Codecov Version Downloads Forks Stars License Frameworks Platforms

BinaryEncoding simplifies the encoding of numbers to BigEndian, LittleEndian and Varint to byte arrays.

API

To set values to an array of bytes:

Binary.BigEndian.Set(bytes, offset, value);
Binary.LittleEndian.Set(bytes, offset, value);
Binary.Varint.Write(bytes, offset, value);

Extension methods are provided for retrieving the bytes:

Binary.BigEndian.GetBytes(value);
Binary.LittleEndian.GetBytes(value);
Binary.Varint.GetBytes(value);

Also, for converting bytes to numbers:

Binary.BigEndian.GetInt16(bytes, offset);
Binary.BigEndian.GetInt32(bytes, offset);
Binary.BigEndian.GetInt64(bytes, offset);
Binary.BigEndian.GetUInt16(bytes, offset);
Binary.BigEndian.GetUInt32(bytes, offset);
Binary.BigEndian.GetUInt64(bytes, offset);
Binary.LittleEndian.GetInt16(bytes, offset);
Binary.LittleEndian.GetInt32(bytes, offset);
Binary.LittleEndian.GetInt64(bytes, offset);
Binary.LittleEndian.GetUInt16(bytes, offset);
Binary.LittleEndian.GetUInt32(bytes, offset);
Binary.LittleEndian.GetUInt64(bytes, offset);

// varint, returns number of bytes consumed
// value can be short, ushort, int, uint, long, ulong
Binary.Varint.Read(bytes, out value);

.. more to come

About

Easy encoding of numbers to BigEndian, LittleEndian and Varint.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.