Hacker News new | past | comments | ask | show | jobs | submit login

The object size has to be at least the alignment size so that arrays work properly--&somearray[1] needs to be properly aligned, and that only works if the object size is a multiple of the alignment: sizeof myint >= _Alignof(myint) && (sizeof myint % _Alignof(myint)) == 0.

As the proposal says, the bit alignment of these types is min(64, next power-of-2(>=N)). (Of course, the alignment can't be smaller than 8 bits, which the proposal fails to account for.) Assuming CHAR_BIT==8, it follows that:

  sizeof _ExtInt(3) == 1   // 5 bits padding
  sizeof _ExtInt(17) == 4  // 15 bits padding
  sizeof _ExtInt(67) == 16 // 61 bits padding
So the amount of padding can be considerable. But that doesn't matter much. What they're trying to conserve is the number of value bits that need to be processed, and in particular minimize the number of logic gates required to process the value. Inside the FPGA presumably the value can be represented with exactly N bits, regardless of how many padding bits there are in external memory.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: