phobos-next ~master (2024-03-19T05:49:32Z)
Home
Dub
Repo
bitsNeeded
nxt
bit_traits
Get number of bits needed to represent the range (0 ..
length
-1).
template
bitsNeeded (
size_t
length
) {
static if
(
length <= 2
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(
length <= 4
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(!(
length <= 4
))
static if
(
length <= 8
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(!(
length <= 4
))
static if
(!(
length <= 8
))
static if
(
length <= 16
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(!(
length <= 4
))
static if
(!(
length <= 8
))
static if
(!(
length <= 16
))
static if
(
length <= 32
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(!(
length <= 4
))
static if
(!(
length <= 8
))
static if
(!(
length <= 16
))
static if
(!(
length <= 32
))
static if
(
length <= 64
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(!(
length <= 4
))
static if
(!(
length <= 8
))
static if
(!(
length <= 16
))
static if
(!(
length <= 32
))
static if
(!(
length <= 64
))
static if
(
length <= 128
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(!(
length <= 4
))
static if
(!(
length <= 8
))
static if
(!(
length <= 16
))
static if
(!(
length <= 32
))
static if
(!(
length <= 64
))
static if
(!(
length <= 128
))
static if
(
length <= 256
)
enum
bitsNeeded
;
static if
(!(
length <= 2
))
static if
(!(
length <= 4
))
static if
(!(
length <= 8
))
static if
(!(
length <= 16
))
static if
(!(
length <= 32
))
static if
(!(
length <= 64
))
static if
(!(
length <= 128
))
static if
(!(
length <= 256
))
static if
(
length <= 512
)
enum
bitsNeeded
;
}
Members
Manifest constants
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
bitsNeeded
enum
bitsNeeded
;
Undocumented in source.
Meta
Source
See Implementation
nxt
bit_traits
templates
bitsNeeded
isAllOneBits
isAllZeroBits
isInitAllOneBits
isInitAllZeroBits
packedBitSizeOf
Get number of bits needed to represent the range (0 .. length-1).