in reply to Re^6: How to assign a variable its width/vector
in thread How to assign a variable its width/vector

You seem to need the size (or length) neither in chars nor in bytes, but in bits.

I think you can take the dec2bin from How do I convert between decimal and binary?

Then, length dec2bin 0x100 (or length(dec2bin(0x100))) gives you a result of 9.

Alternatively, to see if an address fits in 32 bits, you could compare it to 0xffffffff, which is the biggest value to fit.