30 #include <type_traits>
61 const auto startIdx =
byte * 8;
62 const auto byteValue = a[byte];
64 for (
auto bit = 0; bit < 8; ++bit)
66 result[startIdx + bit] = (byteValue & (1 << bit)) >> bit;
74 const auto aShape = a.
shape();
76 const auto resultCSlice = result.
cSlice();
77 const auto aCSlice = a.
cSlice();
122 const auto startIdx =
byte * 8;
123 const auto byteValue = a[byte];
125 for (
auto bit = 0; bit < 8; ++bit)
127 const auto bitToMask =
static_cast<uint8>(7 - bit);
128 result[startIdx + bit] = (byteValue & (1 << bitToMask)) >> bitToMask;
136 const auto aShape = a.
shape();
138 const auto resultCSlice = result.
cSlice();
139 const auto aCSlice = a.
cSlice();
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
NdArray< dtype > & put(int32 inIndex, value_type inValue)
Definition: NdArrayCore.hpp:3479
size_type size() const noexcept
Definition: NdArrayCore.hpp:4105
Slice cSlice(int32 inStartIdx=0, uint32 inStepSize=1) const noexcept
Definition: NdArrayCore.hpp:969
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4092
NdArray< dtype > transpose() const
Definition: NdArrayCore.hpp:4457
uint32 size_type
Definition: NdArrayCore.hpp:88
Definition: Coordinate.hpp:45
NdArray< uint8 > unpackbitsBigEndian(const NdArray< uint8 > &a, Axis axis=Axis::NONE)
Definition: unpackbits.hpp:112
Axis
Enum To describe an axis.
Definition: Types.hpp:47
std::uint8_t uint8
Definition: Types.hpp:42
NdArray< uint8 > unpackbitsLittleEndian(const NdArray< uint8 > &a, Axis axis=Axis::NONE)
Definition: unpackbits.hpp:51