Skip to content

Commit 9664c16

Browse files
committed
Clarify _BitInt memory layout and endianness
Updated _BitInt(N) endianness rules to be more precise: - N ≤ 2×XLEN: follows standard scalar endianness - N > 2×XLEN: divided into 2×XLEN chunks, each chunk follows scalar endianness, but chunks are always stored lower-first regardless of system endianness
1 parent c3a509c commit 9664c16

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

riscv-cc.adoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,12 @@ elemental type by the total number of elements within the vector.
665665
`_BitInt (N)` is the type defined in C23, allow user to define an
666666
arbitrary-sized integer type, where N is a postive integer larger than zero.
667667

668-
`_BitInt(N)` types are stored in little-endian order in memory. Bits in each
669-
byte are allocated from low to high.
668+
`_BitInt(N)` types are stored in memory as follows:
669+
- For N ≤ 2×XLEN: Types follow the standard scalar endianness rules.
670+
- For N > 2×XLEN: Types are divided into 2×XLEN-bit chunks. Each chunk follows
671+
the standard scalar endianness rules. Chunks are always stored in memory with
672+
lower-addressed chunks containing less significant bits, regardless of the
673+
system endianness.
670674

671675
Unused bits of the `_BitInt(N)` are extended based on the signedness of the
672676
type when stored in memory or register. For signed `_BitInt(N)`, unused bits

0 commit comments

Comments
 (0)