storage
Description:
Gets the number of bits used to hold number
, e.
g. if number
is 4, 3 bits are needed.
Example: Compute the numbers of bits used to store a given number:
public static int main (string[] args) {
// Output: ``3`` (4 => 100)
uint bits = Bit.storage (4);
print ("%u\n", bits);
// Output: ``3`` (5 => 101)
bits = Bit.storage (5);
print ("%u\n", bits);
// Output: ``4`` (8 => 1000)
bits = Bit.storage (8);
print ("%u\n", bits);
return 0;
}
valac --pkg glib-2.0 GLib.Bit.storage.vala
Parameters:
number |
a uint |
Returns:
the number of bits used to hold |
Namespace: GLib.Bit
Package: glib-2.0