Skip to content

Instantly share code, notes, and snippets.

@Timer
Created January 8, 2016 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Timer/84cf3798b568136a4745 to your computer and use it in GitHub Desktop.
Save Timer/84cf3798b568136a4745 to your computer and use it in GitHub Desktop.
#include <stdint.h>
template<typename T>
inline uint32_t pack_big_uint32(T a, T b, T c, T d) {
return static_cast<uint32_t>(
static_cast<uint8_t>(d) | static_cast<uint8_t>(c) << 8 |
static_cast<uint8_t>(b) << 16 | static_cast<uint8_t>(a) << 24
);
}
template<typename T>
inline int32_t pack_big_int32(T a, T b, T c, T d) {
return static_cast<int32_t>(pack_big_uint32(a, b, c, d));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment