[ox/std] Rename is_signed to is_signed_v
This commit is contained in:
parent
a5b01bb0d7
commit
7b07edd9e4
6
deps/ox/src/ox/mc/intops.hpp
vendored
6
deps/ox/src/ox/mc/intops.hpp
vendored
@ -28,7 +28,7 @@ template<typename I>
|
|||||||
// find most significant non-sign indicator bit
|
// find most significant non-sign indicator bit
|
||||||
std::size_t highestBit = 0;
|
std::size_t highestBit = 0;
|
||||||
// start at one bit lower if signed
|
// start at one bit lower if signed
|
||||||
if constexpr(ox::is_signed<I>) {
|
if constexpr(ox::is_signed_v<I>) {
|
||||||
--shiftStart;
|
--shiftStart;
|
||||||
}
|
}
|
||||||
for (int i = shiftStart; i > -1; --i) {
|
for (int i = shiftStart; i > -1; --i) {
|
||||||
@ -65,7 +65,7 @@ template<typename I>
|
|||||||
if (val) {
|
if (val) {
|
||||||
// bits needed to represent number factoring in space possibly
|
// bits needed to represent number factoring in space possibly
|
||||||
// needed for signed bit
|
// needed for signed bit
|
||||||
const auto bits = highestBit(val) + 1 + (ox::is_signed<I> ? 1 : 0);
|
const auto bits = highestBit(val) + 1 + (ox::is_signed_v<I> ? 1 : 0);
|
||||||
// bytes needed to store value
|
// bytes needed to store value
|
||||||
std::size_t bytes = bits / 8 + (bits % 8 != 0);
|
std::size_t bytes = bits / 8 + (bits % 8 != 0);
|
||||||
const auto bitsAvailable = bytes * 8; // bits available to integer value
|
const auto bitsAvailable = bytes * 8; // bits available to integer value
|
||||||
@ -128,7 +128,7 @@ template<typename I>
|
|||||||
decoded >>= bytes;
|
decoded >>= bytes;
|
||||||
auto out = static_cast<I>(decoded);
|
auto out = static_cast<I>(decoded);
|
||||||
// move sign bit
|
// move sign bit
|
||||||
if constexpr(ox::is_signed<I>) {
|
if constexpr(ox::is_signed_v<I>) {
|
||||||
const auto valBits = bytes << 3;
|
const auto valBits = bytes << 3;
|
||||||
// get sign
|
// get sign
|
||||||
uint64_t sign = decoded >> (valBits - 1);
|
uint64_t sign = decoded >> (valBits - 1);
|
||||||
|
2
deps/ox/src/ox/std/typetraits.hpp
vendored
2
deps/ox/src/ox/std/typetraits.hpp
vendored
@ -89,7 +89,7 @@ template<typename T>
|
|||||||
constexpr bool is_class_v = ox::is_class<T>();
|
constexpr bool is_class_v = ox::is_class<T>();
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr bool is_signed = ox::integral_constant<bool, T(-1) < T(0)>::value;
|
constexpr bool is_signed_v = ox::integral_constant<bool, T(-1) < T(0)>::value;
|
||||||
|
|
||||||
// enable_if ///////////////////////////////////////////////////////////////////
|
// enable_if ///////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user