On Tue, 2012-05-15 at 11:45 +0300, Lauri Kasanen wrote: > On Mon, 14 May 2012 20:30:15 +0200 > Davidlohr Bueso <[email protected]> wrote: > > > However, by replacing short integers with a character we already cut the > > size of the structure in half (2 vs 1 bytes) and it is a good enough > > optimization. I tend to avoid using bitfields as it fits data into words > > and this is bad when dealing with endianness. There's really no gain > > here anyway, so I'd just label it as a char. > > Hi > > Why should we care about endianness here, when the struct is never written to > disk nor sent anywhere?
Being in memory is enough to cause problems. In any case I'm not saying that it will create issues, just that it's a bad idea to push things into words unless really necessary, and this is certainly not the case. Optimize where it matters. > > A bitfield would cause trouble were the struct concurrently accessed, but as > it's only handled from one thread, I see no downside to using bits there. as with any data... - Davidlohr _______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
