From 8380e406e1a938b7c980696895809691544425f3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 14 Apr 2013 11:50:45 +0200 Subject: [PATCH] mm_io_c: add read_int64_be() --- src/common/mm_io.cpp | 5 +++++ src/common/mm_io.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/common/mm_io.cpp b/src/common/mm_io.cpp index 0d59ca2f0..97b2090dc 100644 --- a/src/common/mm_io.cpp +++ b/src/common/mm_io.cpp @@ -355,6 +355,11 @@ mm_io_c::read_uint16_be() { return get_uint16_be(buffer); } +int32_t +mm_io_c::read_int24_be() { + return (static_cast(read_uint24_be()) + 0xff800000) ^ 0xff800000; +} + uint32_t mm_io_c::read_uint24_be() { unsigned char buffer[3]; diff --git a/src/common/mm_io.h b/src/common/mm_io.h index 8c6e296ef..81b6e5516 100644 --- a/src/common/mm_io.h +++ b/src/common/mm_io.h @@ -53,6 +53,7 @@ public: virtual uint32_t read_uint32_le(); virtual uint64_t read_uint64_le(); virtual uint16_t read_uint16_be(); + virtual int32_t read_int24_be(); virtual uint32_t read_uint24_be(); virtual uint32_t read_uint32_be(); virtual uint64_t read_uint64_be();