Displaying 2 results from an estimated 2 matches for "scalar_storage_order".
2019 Aug 26
2
Non-native endianness support in Clang
Hello,
I'd like to implement the gnu attribute "scalar_storage_order" to mark structs with non-native endianness. My rational is working on network protocols over little endian architecture (for instance: RiscV).
An old bug is open on this issue here:
https://bugs.llvm.org/show_bug.cgi?id=35293
I'd like to discuss the possible ways to implement this.
The...
2018 Jun 01
1
endianness and bit fields in struct{}
...the fact that the size of the package is small (50..200 bytes), it
is only permissible to apply maximally compact binary data exchange
protocols.
As an example, here some sample in C:
#include <stdint.h>
#include <stdbool.h>
struct __attribute__((packed)) {
uint8_t A;
__attribute__((scalar_storage_order("big")))
int16_t B;
float C;
unsigned int D:3;
signed int E:7;
bool F;
} Packet;
void encode() {
Packet.A=1; Packet.B=2; // integers
Packet.C=3; // float
Packet.E=4; Packet.E=-5; // bit field integers
Packet.F = true; // boolean
}
The problem is this definition must be really pla...