get_te64_32() fetches 64 bits, checks and returns 32
modified: packer.h
This commit is contained in:
+8
-7
@@ -260,6 +260,7 @@ protected:
|
|||||||
// permissive version using "void *"
|
// permissive version using "void *"
|
||||||
inline unsigned get_te16(const void *p) const noexcept { return bele->get16(p); }
|
inline unsigned get_te16(const void *p) const noexcept { return bele->get16(p); }
|
||||||
inline unsigned get_te32(const void *p) const noexcept { return bele->get32(p); }
|
inline unsigned get_te32(const void *p) const noexcept { return bele->get32(p); }
|
||||||
|
inline unsigned get_te64_32(const void *p) const { return (unsigned) bele->get64(p); }
|
||||||
inline upx_uint64_t get_te64(const void *p) const noexcept { return bele->get64(p); }
|
inline upx_uint64_t get_te64(const void *p) const noexcept { return bele->get64(p); }
|
||||||
inline void set_te16(void *p, unsigned v) noexcept { bele->set16(p, v); }
|
inline void set_te16(void *p, unsigned v) noexcept { bele->set16(p, v); }
|
||||||
inline void set_te32(void *p, unsigned v) noexcept { bele->set32(p, v); }
|
inline void set_te32(void *p, unsigned v) noexcept { bele->set32(p, v); }
|
||||||
@@ -292,6 +293,13 @@ protected:
|
|||||||
return bele->get32(p);
|
return bele->get32(p);
|
||||||
}
|
}
|
||||||
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 {
|
||||||
|
upx_uint64_t val = get_te64(p);
|
||||||
|
if (val >> 32)
|
||||||
|
throwCantPack("64-bit value too big %#llx", val);
|
||||||
|
return (unsigned) val;
|
||||||
|
}
|
||||||
|
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 {
|
||||||
return bele->get64(p);
|
return bele->get64(p);
|
||||||
}
|
}
|
||||||
@@ -309,13 +317,6 @@ protected:
|
|||||||
bele->set64(p, v);
|
bele->set64(p, v);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
template <class T, class = enable_if_te64<T> >
|
|
||||||
inline upx_uint64_t get_te64_32(const T *p) const {
|
|
||||||
upx_uint64_t val = get_te64(p);
|
|
||||||
if (val >> 32)
|
|
||||||
throwCantPack("64-bit value too big %#llx", val);
|
|
||||||
return (unsigned) val;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const N_BELE_RTP::AbstractPolicy *bele = nullptr; // TE - Target Endianness
|
const N_BELE_RTP::AbstractPolicy *bele = nullptr; // TE - Target Endianness
|
||||||
|
|||||||
Reference in New Issue
Block a user