Questions tagged [padding-bit]

In C and older C++ the bits of the object representation of unsigned integer types other than `unsigned char` are divided into two groups: value bits and padding bits with the latter being optional

4 questions
16
votes
1 answer

Padding bits in unsigned integers and bitwise operations in C89

I have a lot of code that performs bitwise operations on unsigned integers. I wrote my code with the assumption that those operations were on integers of fixed width without any padding bits. For example an array of 32-bit unsigned integers of which…
11
votes
3 answers

Are there any existing C implementations having padding bit in (un)signed integer representation?

As per C99, there maybe padding bits in signed int or unsigned int representation . So I wonder are there still any implementations having such outdated things?
l4rmbr
  • 1,227
  • 7
  • 22
3
votes
2 answers

Do padding bits need to be preserved?

The MSP430X architecture is an extension of the 16 bit MSP430 architecture to a 20 bit address space. This is done by expanding the processor's registers to 20 bit, keeping the least addressable unit at one octet (CHAR_BIT equals 8). On this…
fuz
  • 88,405
  • 25
  • 200
  • 352
2
votes
0 answers

How to check In C language whether an int variable contains a legal (not trap representation) value?

Context: This is a followup to that other question of mine. I asked about both C and C++ and soon got an answer about C++ because last draft for C++20 explicitly requires that signed integer types use two's complement and that padding bits (if any)…
Serge Ballesta
  • 143,923
  • 11
  • 122
  • 252