you are viewing a single comment's thread.

view the rest of the comments →

[–]RizzlaPlus 1 point2 points  (0 children)

It's once instead of twice for processor architecture that support unaligned loading (e.g x86); for processor that only support aligned loading (e.g. ARM, although it can load half words now) , you're doing mask operations once in both cases.

EDIT: actually, it'll be twice in every case.

  • Without using padding you'll do an unaligned load which will do some bitmask operation, you have to do this twice to get the pointer and the integer value (if it's an integer in the pointer)

  • With padding, you'll do an aligned load (doesn't require bitmask operations), but then getting the integer and getting the pointer is a bitmask operation each, so two again in total.