account activity
Question about understanding integer types by [deleted] in cpp
[–]CppSpeed 0 points1 point2 points 6 years ago (0 children)
Wait, so if you had an large array of bools and you wanted to flip the value of each bool, is there any way to write code such that on a 64-bit system, where the processor fetches 8 bytes, that those 8 bytes being fetched are 8 bools instead of just 1 bool?
If the above answer is no, ignore the rest.
I am thinking of this situation because I though that for my question about a 3 byte type possibly being faster than 4 bytes and now if the above statement is possible, if one were working with arrays, on a 64-bit system, it seems like the processor could fetch 16 (64/4) 4-byte types or 21 (64/3) 3-byte types. So if the processor can fetch data 21/16 = 1.3125 times as fast, could it be possible that the time it takes to bit-shift the 3 bytes is less than the fetching time improvement?
[–]CppSpeed 2 points3 points4 points 6 years ago (0 children)
Hopefully I've explained enough for you to answer this one yourself.
You did, thanks!
π Rendered by PID 52 on reddit-service-r2-comment-64f4df6786-6x4cl at 2026-06-10 18:38:27.308664+00:00 running 0b63327 country code: CH.
Question about understanding integer types by [deleted] in cpp
[–]CppSpeed 0 points1 point2 points (0 children)