HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
File: C:/Ruby27-x64/share/ri/2.7.0/system/Integer/bit_length-i.ri
U:RDoc::AnyMethod[iI"bit_length:ETI"Integer#bit_length;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[I"6Returns the number of bits of the value of +int+.;To:RDoc::Markup::BlankLineo;
;	[	I"@"Number of bits" means the bit position of the highest bit ;TI"*which is different from the sign bit ;TI";(where the least significant bit has bit position 1). ;TI"CIf there is no such bit (zero or minus one), zero is returned.;T@o;
;	[I"HI.e. this method returns <i>ceil(log2(int < 0 ? -int : int+1))</i>.;T@o:RDoc::Markup::Verbatim;	[I"((-2**1000-1).bit_length   #=> 1001
;TI"((-2**1000).bit_length     #=> 1000
;TI"((-2**1000+1).bit_length   #=> 1000
;TI"&(-2**12-1).bit_length     #=> 13
;TI"&(-2**12).bit_length       #=> 12
;TI"&(-2**12+1).bit_length     #=> 12
;TI"%-0x101.bit_length         #=> 9
;TI"%-0x100.bit_length         #=> 8
;TI"%-0xff.bit_length          #=> 8
;TI"%-2.bit_length             #=> 1
;TI"%-1.bit_length             #=> 0
;TI"%0.bit_length              #=> 0
;TI"%1.bit_length              #=> 1
;TI"%0xff.bit_length           #=> 8
;TI"%0x100.bit_length          #=> 9
;TI"&(2**12-1).bit_length      #=> 12
;TI"&(2**12).bit_length        #=> 13
;TI"&(2**12+1).bit_length      #=> 13
;TI"((2**1000-1).bit_length    #=> 1000
;TI"((2**1000).bit_length      #=> 1001
;TI"((2**1000+1).bit_length    #=> 1001
;T:@format0o;
;	[I"IThis method can be used to detect overflow in Array#pack as follows:;T@o;;	[
I"if n.bit_length < 32
;TI"#  [n].pack("l") # no overflow
;TI"
else
;TI"  raise "overflow"
;TI"end;T;
0:
@fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"!int.bit_length  ->  integer
;T0[I"();T@9FI"Integer;TcRDoc::NormalClass00