summaryrefslogtreecommitdiff
path: root/apps/metadata/metadata_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/metadata/metadata_common.c')
-rw-r--r--apps/metadata/metadata_common.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c
index 318399693c..fd1cd553e8 100644
--- a/apps/metadata/metadata_common.c
+++ b/apps/metadata/metadata_common.c
@@ -174,6 +174,15 @@ int read_uint64le(int fd, uint64_t* buf)
174} 174}
175#endif 175#endif
176 176
177/* Read an unaligned 64-bit little endian unsigned integer from buffer. */
178uint64_t get_uint64_le(void* buf)
179{
180 unsigned char* p = (unsigned char*) buf;
181
182 return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24) | ((uint64_t)p[4] << 32) |
183 ((uint64_t)p[5] << 40) | ((uint64_t)p[6] << 48) | ((uint64_t)p[7] << 56);
184}
185
177/* Read an unaligned 32-bit little endian long from buffer. */ 186/* Read an unaligned 32-bit little endian long from buffer. */
178unsigned long get_long_le(void* buf) 187unsigned long get_long_le(void* buf)
179{ 188{