byte and short data types use cases
Salih Dincer
salihdb at hotmail.com
Sat Jun 10 18:26:15 UTC 2023
On Friday, 9 June 2023 at 23:51:07 UTC, Basile B. wrote:
> Yes, a classsic resource is
> http://www.catb.org/esr/structure-packing/
>
>> So you can optimize memory usage by using arrays of things
>> smaller than `int` if these are enough for your purposes,
So, is the sorting correct in a structure like the one below with
partial overlap?
```d
struct DATA
{
union
{
ulong bits;
ubyte[size] cell;
}
enum size = 5;
bool last;
alias last this;
size_t length, limit, index = ulong.sizeof;
bool empty()
{
return index / ulong.sizeof >= limit; }
ubyte[] data;
ubyte front()
{
//..
```
This code snippet is from an actual working my project. What is
done is to process 40 bits of data.
SDB at 79
More information about the Digitalmars-d-learn
mailing list