Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^7: How to assign a variable its width/vector

by soonix (Canon)
on Apr 15, 2014 at 09:29 UTC ( [id://1082326]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1082326]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found