| 693 | // ------------------------------------------------ |
| 694 | |
| 695 | int Int::GetBitLength() { |
| 696 | |
| 697 | Int t(this); |
| 698 | if(IsNegative()) |
| 699 | t.Neg(); |
| 700 | |
| 701 | int i=NB32BLOCK-1; |
| 702 | while(i>=0 && t.bits[i]==0) i--; |
| 703 | if(i<0) return 0; |
| 704 | return (32-bitLength(t.bits[i])) + i*32; |
| 705 | |
| 706 | } |
| 707 | |
| 708 | // ------------------------------------------------ |
| 709 |