I'm always a bit nervous about explicitly using shifts and masks to do arithmetic - too much opportunity for funny endianness to break this. I suggest you really want. And you shouldn't be using 8 bits explicitly for a byte (think CDC 6600).
```C
  int bits = gdbarch_ptr_bit (gdbarch);
  return (bits + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT;
```
The compiler can worry about optimizing into shifts and masks,