On Jan 7 21:27, Ken Brown wrote: > On 1/7/2025 3:18 PM, Corinna Vinschen wrote: > > - mmap_record::prot flag, should be an array of protection bits per page > > (POSIX page i e., 64K, not Windows page). > > Question: Since it only takes 3 bits to store all possible protections, do > you think it's worth the trouble to pack the protections, so that each byte > stores the protection bits for 2 pages? Or should I just use an array of > unsigned char, with 1 byte for each page? Or did you have something else in > mind?
I hadn't thought deeply about this. I had a vague notion of a ULONG array to match windows protection bits, but, as you note above, we really only need 3 bits. I don't think we have to define this as a bit field array, given this isn't readily available in C and you would have to add bitfield arithmetic by yourself. So, yeah, a char or maybe better uint8_t might be the best matching type here. Thanks, Corinna