introducing getULongLong()
This commit is contained in:
parent
dc331ee44a
commit
ab27bfab3c
@ -266,6 +266,8 @@ namespace Exiv2 {
|
||||
EXIV2API uint16_t getUShort(const byte* buf, ByteOrder byteOrder);
|
||||
//! Read a 4 byte unsigned long value from the data buffer
|
||||
EXIV2API uint32_t getULong(const byte* buf, ByteOrder byteOrder);
|
||||
//! Read a 8 byte unsigned long value from the data buffer
|
||||
EXIV2API uint64_t getULongLong(const byte* buf, ByteOrder byteOrder);
|
||||
//! Read an 8 byte unsigned rational value from the data buffer
|
||||
EXIV2API URational getURational(const byte* buf, ByteOrder byteOrder);
|
||||
//! Read a 2 byte signed short value from the data buffer
|
||||
|
||||
@ -252,6 +252,22 @@ namespace Exiv2 {
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t getULongLong(const byte* buf, ByteOrder byteOrder)
|
||||
{
|
||||
if (byteOrder == littleEndian) {
|
||||
return (uint64_t)buf[7] << 56 | (uint64_t)buf[6] << 48
|
||||
| (uint64_t)buf[5] << 40 | (uint64_t)buf[4] << 32
|
||||
| (uint64_t)buf[3] << 24 | (uint64_t)buf[2] << 16
|
||||
| (uint64_t)buf[1] << 8 | (uint64_t)buf[0];
|
||||
}
|
||||
else {
|
||||
return (uint64_t)buf[0] << 56 | (uint64_t)buf[1] << 48
|
||||
| (uint64_t)buf[2] << 40 | (uint64_t)buf[3] << 32
|
||||
| (uint64_t)buf[4] << 24 | (uint64_t)buf[5] << 16
|
||||
| (uint64_t)buf[6] << 8 | (uint64_t)buf[7];
|
||||
}
|
||||
}
|
||||
|
||||
URational getURational(const byte* buf, ByteOrder byteOrder)
|
||||
{
|
||||
uint32_t nominator = getULong(buf, byteOrder);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user