CI updates

This commit is contained in:
Markus F.X.J. Oberhumer 2025-11-25 09:15:40 +01:00
parent 98c00d0fcb
commit f83b7690e5
12 changed files with 123 additions and 57 deletions

View File

@ -104,7 +104,7 @@ jobs:
- run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true - run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- run: sudo dmidecode -q || true - run: sudo dmidecode -q || true
- run: sudo dmidecode || true - run: sudo dmidecode || true
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- run: make build/extra/gcc/all - run: make build/extra/gcc/all
- run: make build/extra/clang/all - run: make build/extra/clang/all
@ -183,7 +183,7 @@ jobs:
sudo apt-get install -y wine wine32:i386 wine64 sudo apt-get install -y wine wine32:i386 wine64
ls -l /usr/bin/wine* ls -l /usr/bin/wine*
mkdir -p -v ~/.wine && wineboot --init mkdir -p -v ~/.wine && wineboot --init
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
@ -324,7 +324,7 @@ jobs:
# TODO FIXME: UPX on macos-13+ is broken => disable run-packed for now # TODO FIXME: UPX on macos-13+ is broken => disable run-packed for now
macos-[12][3456]*) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;; macos-[12][3456]*) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;;
esac esac
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
if: ${{ matrix.testsuite }} if: ${{ matrix.testsuite }}
@ -425,7 +425,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
@ -504,7 +504,7 @@ jobs:
B: release B: release
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: Prepare sources and Check out test suite - name: Prepare sources and Check out test suite
run: | run: |
@ -640,7 +640,7 @@ jobs:
git config --global --add safe.directory '*' # needed when running in a container git config --global --add safe.directory '*' # needed when running in a container
mkdir -p ~/.parallel && : > ~/.parallel/$(echo 6305-4721 | tr 0-7 leticlwi) mkdir -p ~/.parallel && : > ~/.parallel/$(echo 6305-4721 | tr 0-7 leticlwi)
- run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true - run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: { submodules: true } with: { submodules: true }
- name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }} - name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }}
run: | run: |

View File

@ -295,13 +295,15 @@ forceinline constexpr upx_uint64_t no_bswap64(upx_uint64_t v) noexcept { return
#define ne16_to_le16(v) bswap16(v) #define ne16_to_le16(v) bswap16(v)
#define ne32_to_le32(v) bswap32(v) #define ne32_to_le32(v) bswap32(v)
#define ne64_to_le64(v) bswap64(v) #define ne64_to_le64(v) bswap64(v)
#else #elif (ACC_ABI_LITTLE_ENDIAN)
#define ne16_to_be16(v) bswap16(v) #define ne16_to_be16(v) bswap16(v)
#define ne32_to_be32(v) bswap32(v) #define ne32_to_be32(v) bswap32(v)
#define ne64_to_be64(v) bswap64(v) #define ne64_to_be64(v) bswap64(v)
#define ne16_to_le16(v) no_bswap16(v) #define ne16_to_le16(v) no_bswap16(v)
#define ne32_to_le32(v) no_bswap32(v) #define ne32_to_le32(v) no_bswap32(v)
#define ne64_to_le64(v) no_bswap64(v) #define ne64_to_le64(v) no_bswap64(v)
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
/************************************************************************* /*************************************************************************
@ -360,8 +362,12 @@ inline constexpr unsigned get_be24(const byte *p) noexcept {
inline constexpr unsigned get_le24(const byte *p) noexcept { inline constexpr unsigned get_le24(const byte *p) noexcept {
return upx::compile_time::get_le24(p); return upx::compile_time::get_le24(p);
} }
inline constexpr unsigned get_ne24(const byte *p) noexcept {
return upx::compile_time::get_ne24(p);
}
inline constexpr void set_be24(byte *p, unsigned v) noexcept { upx::compile_time::set_be24(p, v); } inline constexpr void set_be24(byte *p, unsigned v) noexcept { upx::compile_time::set_be24(p, v); }
inline constexpr void set_le24(byte *p, unsigned v) noexcept { upx::compile_time::set_le24(p, v); } inline constexpr void set_le24(byte *p, unsigned v) noexcept { upx::compile_time::set_le24(p, v); }
inline constexpr void set_ne24(byte *p, unsigned v) noexcept { upx::compile_time::set_ne24(p, v); }
REQUIRE_XE24 REQUIRE_XE24
forceinline bele_constexpr unsigned get_be24(const XE24 *p) noexcept { forceinline bele_constexpr unsigned get_be24(const XE24 *p) noexcept {
@ -372,6 +378,10 @@ forceinline bele_constexpr unsigned get_le24(const XE24 *p) noexcept {
return get_le24(upx::ptr_static_cast<const byte *>(p)); return get_le24(upx::ptr_static_cast<const byte *>(p));
} }
REQUIRE_XE24 REQUIRE_XE24
forceinline bele_constexpr unsigned get_ne24(const XE24 *p) noexcept {
return get_ne24(upx::ptr_static_cast<const byte *>(p));
}
REQUIRE_XE24
forceinline bele_constexpr void set_be24(XE24 *p, unsigned v) noexcept { forceinline bele_constexpr void set_be24(XE24 *p, unsigned v) noexcept {
set_be24(upx::ptr_static_cast<byte *>(p), v); set_be24(upx::ptr_static_cast<byte *>(p), v);
} }
@ -379,6 +389,10 @@ REQUIRE_XE24
forceinline bele_constexpr void set_le24(XE24 *p, unsigned v) noexcept { forceinline bele_constexpr void set_le24(XE24 *p, unsigned v) noexcept {
set_le24(upx::ptr_static_cast<byte *>(p), v); set_le24(upx::ptr_static_cast<byte *>(p), v);
} }
REQUIRE_XE24
forceinline bele_constexpr void set_ne24(XE24 *p, unsigned v) noexcept {
set_ne24(upx::ptr_static_cast<byte *>(p), v);
}
REQUIRE_XE32 REQUIRE_XE32
inline bele_constexpr unsigned get_le26(const XE32 *p) noexcept { return get_le32(p) & 0x03ffffff; } inline bele_constexpr unsigned get_le26(const XE32 *p) noexcept { return get_le32(p) & 0x03ffffff; }
@ -1085,7 +1099,7 @@ TT_UPX_IS_INTEGRAL(LE32);
TT_UPX_IS_INTEGRAL(LE64); TT_UPX_IS_INTEGRAL(LE64);
#undef TT_UPX_IS_INTEGRAL #undef TT_UPX_IS_INTEGRAL
// native types // NE - Native Endianness (aka Host Endianness aka CPU Endianness)
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
typedef BE16 NE16; typedef BE16 NE16;
typedef BE32 NE32; typedef BE32 NE32;
@ -1096,7 +1110,7 @@ typedef BE64 NE64;
#define ne16_compare_signed be16_compare_signed #define ne16_compare_signed be16_compare_signed
#define ne32_compare_signed be32_compare_signed #define ne32_compare_signed be32_compare_signed
#define ne64_compare_signed be64_compare_signed #define ne64_compare_signed be64_compare_signed
#else #elif (ACC_ABI_LITTLE_ENDIAN)
typedef LE16 NE16; typedef LE16 NE16;
typedef LE32 NE32; typedef LE32 NE32;
typedef LE64 NE64; typedef LE64 NE64;
@ -1106,6 +1120,8 @@ typedef LE64 NE64;
#define ne16_compare_signed le16_compare_signed #define ne16_compare_signed le16_compare_signed
#define ne32_compare_signed le32_compare_signed #define ne32_compare_signed le32_compare_signed
#define ne64_compare_signed le64_compare_signed #define ne64_compare_signed le64_compare_signed
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
/************************************************************************* /*************************************************************************

View File

@ -210,7 +210,7 @@ private:
UPX_CXX_DISABLE_NEW_DELETE(LEPolicy) UPX_CXX_DISABLE_NEW_DELETE(LEPolicy)
}; };
// Native Endianness policy (aka Host Policy) // NE - Native Endianness policy (aka Host Policy)
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
typedef BEPolicy NEPolicy; typedef BEPolicy NEPolicy;
typedef BEPolicy HostPolicy; typedef BEPolicy HostPolicy;

View File

@ -1467,7 +1467,8 @@ TEST_CASE("libc qsort") {
return true; return true;
} }
}; };
constexpr size_t N = 4096;
constexpr size_t N = 256;
Elem e[N]; Elem e[N];
for (size_t n = 0; n <= N; n = 2 * n + 1) { for (size_t n = 0; n <= N; n = 2 * n + 1) {
// system sort functions // system sort functions

View File

@ -35,7 +35,7 @@ class ElfLinker /*not_final*/ : private upx::noncopyable {
friend class Packer; friend class Packer;
public: public:
const N_BELE_RTP::AbstractPolicy *const bele; // target endianness const N_BELE_RTP::AbstractPolicy *const bele; // TE - Target Endianness
protected: protected:
struct Section; struct Section;
struct Symbol; struct Symbol;

View File

@ -1015,9 +1015,9 @@ void Packer::compressWithFilters(byte *i_ptr,
byte *const hdr_ptr, const unsigned hdr_len, byte *const hdr_ptr, const unsigned hdr_len,
Filter *const parm_ft, // updated Filter *const parm_ft, // updated
const unsigned overlap_range, const unsigned overlap_range,
upx_compress_config_t const *const cconf, const upx_compress_config_t *const cconf,
int filter_strategy, // in+out for prepareFilters int filter_strategy, // in+out for prepareFilters
bool const inhibit_compression_check) { const bool inhibit_compression_check) {
parm_ft->buf_len = f_len; parm_ft->buf_len = f_len;
// struct copies // struct copies
const PackHeader orig_ph = this->ph; const PackHeader orig_ph = this->ph;
@ -1219,7 +1219,7 @@ void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range,
} }
void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range, void Packer::compressWithFilters(Filter *ft, const unsigned overlap_range,
upx_compress_config_t const *cconf, int filter_strategy, const upx_compress_config_t *cconf, int filter_strategy,
unsigned filter_off, unsigned ibuf_off, unsigned obuf_off, unsigned filter_off, unsigned ibuf_off, unsigned obuf_off,
byte *const hdr_ptr, unsigned hdr_len, byte *const hdr_ptr, unsigned hdr_len,
bool inhibit_compression_check) { bool inhibit_compression_check) {

View File

@ -162,7 +162,7 @@ protected:
unsigned f_len, // subset of [*i_ptr, +i_len) unsigned f_len, // subset of [*i_ptr, +i_len)
byte *const hdr_ptr, unsigned hdr_len, byte *const hdr_ptr, unsigned hdr_len,
Filter *parm_ft, // updated Filter *parm_ft, // updated
unsigned overlap_range, upx_compress_config_t const *cconf, unsigned overlap_range, const upx_compress_config_t *cconf,
int filter_strategy, bool inhibit_compression_check = false); int filter_strategy, bool inhibit_compression_check = false);
// util for verifying overlapping decompression // util for verifying overlapping decompression
@ -294,10 +294,10 @@ protected:
} }
template <class T, class = enable_if_te64<T> > template <class T, class = enable_if_te64<T> >
inline unsigned get_te64_32(const T *p) const { inline unsigned get_te64_32(const T *p) const {
upx_uint64_t val = get_te64(p); upx_uint64_t v = bele->get64(p);
if (val >> 32) if ((v >> 32) != 0)
throwCantPack("64-bit value too big %#llx", val); throwCantPack("64-bit value too big %#llx", v);
return (unsigned) val; return (unsigned) v;
} }
template <class T, class = enable_if_te64<T> > template <class T, class = enable_if_te64<T> >
inline upx_uint64_t get_te64(const T *p) const noexcept { inline upx_uint64_t get_te64(const T *p) const noexcept {

View File

@ -1480,19 +1480,18 @@ void PeFile::processTls2(Reloc *const rel, const Interval *const iv, unsigned ne
if (sotls == 0) if (sotls == 0)
return; return;
// add new relocation entries
// add new relocation entries
if (tls_handler_offset > 0 && tls_handler_offset_reloc > 0) if (tls_handler_offset > 0 && tls_handler_offset_reloc > 0)
rel->add_reloc(tls_handler_offset + tls_handler_offset_reloc, reloc_type); rel->add_reloc(tls_handler_offset + tls_handler_offset_reloc, reloc_type);
unsigned ic;
// NEW: if TLS callbacks are used, relocate the VA of the callback chain, too - Stefan Widmann // NEW: if TLS callbacks are used, relocate the VA of the callback chain, too - Stefan Widmann
for (ic = 0; ic < (unsigned) (use_tls_callbacks ? 4 : 3); ic++) for (unsigned ic = 0; ic < (unsigned) (use_tls_callbacks ? 4 : 3); ic++)
rel->add_reloc(newaddr + ic * cb_size, reloc_type); rel->add_reloc(newaddr + ic * cb_size, reloc_type);
SPAN_S_VAR(tls, const tlsp, mb_otls); SPAN_S_VAR(tls, const tlsp, mb_otls);
// now the relocation entries in the tls data area // now the relocation entries in the tls data area
for (ic = 0; ic < iv->ivnum; ic++) { for (unsigned ic = 0; ic < iv->ivnum; ic++) {
SPAN_S_VAR(byte, const pp, SPAN_S_VAR(byte, const pp,
otls + (iv->ivarr[ic].start - (tlsp->datastart - imagebase) + sizeof(tls))); otls + (iv->ivarr[ic].start - (tlsp->datastart - imagebase) + sizeof(tls)));
LEXX *const p = (LEXX *) raw_bytes(pp, sizeof(LEXX)); LEXX *const p = (LEXX *) raw_bytes(pp, sizeof(LEXX));

View File

@ -192,58 +192,74 @@ forceinline constexpr void set_le64(byte *p, upx_uint64_t v) noexcept {
forceinline constexpr upx_uint16_t get_ne16(const byte *p) noexcept { forceinline constexpr upx_uint16_t get_ne16(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be16(p); return get_be16(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le16(p); return get_le16(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr upx_uint32_t get_ne24(const byte *p) noexcept { forceinline constexpr upx_uint32_t get_ne24(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be24(p); return get_be24(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le24(p); return get_le24(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr upx_uint32_t get_ne32(const byte *p) noexcept { forceinline constexpr upx_uint32_t get_ne32(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be32(p); return get_be32(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le32(p); return get_le32(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr upx_uint64_t get_ne64(const byte *p) noexcept { forceinline constexpr upx_uint64_t get_ne64(const byte *p) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
return get_be64(p); return get_be64(p);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
return get_le64(p); return get_le64(p);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne16(byte *p, upx_uint16_t v) noexcept { forceinline constexpr void set_ne16(byte *p, upx_uint16_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be16(p, v); set_be16(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le16(p, v); set_le16(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne24(byte *p, upx_uint32_t v) noexcept { forceinline constexpr void set_ne24(byte *p, upx_uint32_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be24(p, v); set_be24(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le24(p, v); set_le24(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne32(byte *p, upx_uint32_t v) noexcept { forceinline constexpr void set_ne32(byte *p, upx_uint32_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be32(p, v); set_be32(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le32(p, v); set_le32(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
forceinline constexpr void set_ne64(byte *p, upx_uint64_t v) noexcept { forceinline constexpr void set_ne64(byte *p, upx_uint64_t v) noexcept {
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
set_be64(p, v); set_be64(p, v);
#else #elif (ACC_ABI_LITTLE_ENDIAN)
set_le64(p, v); set_le64(p, v);
#else
#error "ACC_ABI_ENDIAN"
#endif #endif
} }
@ -357,16 +373,17 @@ private:
#define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) private: #define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) private:
#endif #endif
class noncopyable { class NonCopyAble {
protected: protected:
forceinline constexpr noncopyable() noexcept {} forceinline constexpr NonCopyAble() noexcept {}
#if __cplusplus >= 202002L #if __cplusplus >= 202002L
forceinline constexpr ~noncopyable() noexcept = default; forceinline constexpr ~NonCopyAble() noexcept = default;
#else #else
forceinline ~noncopyable() noexcept = default; forceinline ~NonCopyAble() noexcept = default;
#endif #endif
UPX_CXX_DISABLE_COPY_MOVE(noncopyable) UPX_CXX_DISABLE_COPY_MOVE(NonCopyAble)
}; };
typedef NonCopyAble noncopyable;
/************************************************************************* /*************************************************************************
// <type_traits> // <type_traits>

View File

@ -292,30 +292,47 @@ TEST_CASE("MemBuffer core") {
} }
TEST_CASE("MemBuffer global overloads") { TEST_CASE("MemBuffer global overloads") {
MemBuffer mb(1); MemBuffer mb1(1);
MemBuffer mb4(4); MemBuffer mb4(4);
mb.clear(); mb1.clear();
mb4.clear(); mb4.clear();
CHECK(memcmp(mb, "\x00", 1) == 0); CHECK(memcmp(mb1, "\x00", 1) == 0);
CHECK_THROWS(memcmp(mb, "\x00\x00", 2)); // NOLINT(bugprone-unused-return-value) CHECK_THROWS(memcmp(mb1, "\x00\x00", 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp("\x00\x00", mb, 2)); // NOLINT(bugprone-unused-return-value) CHECK_THROWS(memcmp("\x00\x00", mb1, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb, mb4, 2)); // NOLINT(bugprone-unused-return-value) CHECK_THROWS(memcmp(mb1, mb4, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_THROWS(memcmp(mb4, mb, 2)); // NOLINT(bugprone-unused-return-value) CHECK_THROWS(memcmp(mb4, mb1, 2)); // NOLINT(bugprone-unused-return-value)
CHECK_NOTHROW(memset(mb, 255, 1)); CHECK_NOTHROW(memset(mb1, 255, 1));
CHECK_THROWS(memset(mb, 254, 2)); CHECK_THROWS(memset(mb1, 254, 2));
CHECK(mb[0] == 255); CHECK(mb1[0] == 255);
CHECK_THROWS(get_be16(mb));
CHECK_THROWS(get_be32(mb)); CHECK_THROWS(get_ne16(mb1));
CHECK_THROWS(get_be64(mb)); CHECK_THROWS(get_ne24(mb1));
CHECK_THROWS(get_le16(mb)); CHECK_THROWS(get_ne32(mb1));
CHECK_THROWS(get_le32(mb)); CHECK_THROWS(get_ne64(mb1));
CHECK_THROWS(get_le64(mb)); CHECK_THROWS(get_be16(mb1));
CHECK_THROWS(get_be24(mb1));
CHECK_THROWS(get_be32(mb1));
CHECK_THROWS(get_be64(mb1));
CHECK_THROWS(get_le16(mb1));
CHECK_THROWS(get_le24(mb1));
CHECK_THROWS(get_le32(mb1));
CHECK_THROWS(get_le64(mb1));
CHECK_NOTHROW(get_ne16(mb4));
CHECK_NOTHROW(get_ne24(mb4));
CHECK_NOTHROW(get_ne32(mb4));
CHECK_THROWS(get_ne64(mb4));
CHECK_NOTHROW(get_be16(mb4)); CHECK_NOTHROW(get_be16(mb4));
CHECK_NOTHROW(get_be24(mb4));
CHECK_NOTHROW(get_be32(mb4)); CHECK_NOTHROW(get_be32(mb4));
CHECK_THROWS(get_be64(mb4)); CHECK_THROWS(get_be64(mb4));
CHECK_NOTHROW(get_le16(mb4)); CHECK_NOTHROW(get_le16(mb4));
CHECK_NOTHROW(get_le24(mb4));
CHECK_NOTHROW(get_le32(mb4)); CHECK_NOTHROW(get_le32(mb4));
CHECK_THROWS(get_le64(mb4)); CHECK_THROWS(get_le64(mb4));
CHECK_NOTHROW(set_ne32(mb4, 0));
CHECK_THROWS(set_ne64(mb4, 0));
CHECK_NOTHROW(set_be32(mb4, 0)); CHECK_NOTHROW(set_be32(mb4, 0));
CHECK_THROWS(set_be64(mb4, 0)); CHECK_THROWS(set_be64(mb4, 0));
CHECK_NOTHROW(set_le32(mb4, 0)); CHECK_NOTHROW(set_le32(mb4, 0));
@ -324,13 +341,13 @@ TEST_CASE("MemBuffer global overloads") {
TEST_CASE("MemBuffer unused 1") { TEST_CASE("MemBuffer unused 1") {
MemBuffer mb; MemBuffer mb;
CHECK(mb.raw_ptr() == nullptr); (void) mb;
CHECK(mb.raw_size_in_bytes() == 0);
} }
TEST_CASE("MemBuffer unused 2") { TEST_CASE("MemBuffer unused 2") {
MemBuffer mb; MemBuffer mb;
(void) mb; CHECK(mb.raw_ptr() == nullptr);
CHECK(mb.raw_size_in_bytes() == 0);
} }
TEST_CASE("MemBuffer array access") { TEST_CASE("MemBuffer array access") {

View File

@ -75,6 +75,6 @@
#define _LIBCPP_HAS_ALIGNED_ALLOCATION 0 #define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
#endif #endif
#endif #endif
#endif #endif // _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
/* vim:set ts=4 sw=4 et: */ /* vim:set ts=4 sw=4 et: */

View File

@ -204,6 +204,10 @@ inline unsigned get_ne16(const C<T> &a) {
return get_ne16(a.raw_bytes(2)); return get_ne16(a.raw_bytes(2));
} }
template <class T> template <class T>
inline unsigned get_ne24(const C<T> &a) {
return get_ne24(a.raw_bytes(3));
}
template <class T>
inline unsigned get_ne32(const C<T> &a) { inline unsigned get_ne32(const C<T> &a) {
return get_ne32(a.raw_bytes(4)); return get_ne32(a.raw_bytes(4));
} }
@ -217,6 +221,10 @@ inline unsigned get_be16(const C<T> &a) {
return get_be16(a.raw_bytes(2)); return get_be16(a.raw_bytes(2));
} }
template <class T> template <class T>
inline unsigned get_be24(const C<T> &a) {
return get_be24(a.raw_bytes(3));
}
template <class T>
inline unsigned get_be32(const C<T> &a) { inline unsigned get_be32(const C<T> &a) {
return get_be32(a.raw_bytes(4)); return get_be32(a.raw_bytes(4));
} }
@ -247,6 +255,10 @@ inline void set_ne16(const C<T> &a, unsigned v) {
return set_ne16(a.raw_bytes(2), v); return set_ne16(a.raw_bytes(2), v);
} }
template <class T> template <class T>
inline void set_ne24(const C<T> &a, unsigned v) {
return set_ne24(a.raw_bytes(3), v);
}
template <class T>
inline void set_ne32(const C<T> &a, unsigned v) { inline void set_ne32(const C<T> &a, unsigned v) {
return set_ne32(a.raw_bytes(4), v); return set_ne32(a.raw_bytes(4), v);
} }
@ -260,6 +272,10 @@ inline void set_be16(const C<T> &a, unsigned v) {
return set_be16(a.raw_bytes(2), v); return set_be16(a.raw_bytes(2), v);
} }
template <class T> template <class T>
inline void set_be24(const C<T> &a, unsigned v) {
return set_be24(a.raw_bytes(3), v);
}
template <class T>
inline void set_be32(const C<T> &a, unsigned v) { inline void set_be32(const C<T> &a, unsigned v) {
return set_be32(a.raw_bytes(4), v); return set_be32(a.raw_bytes(4), v);
} }