Changeset 6ef61063


Ignore:
Timestamp:
Mar 8, 2017 4:25:27 PM (3 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6fbeef5
Parents:
23ee40d
Message:

Random: Don't need extra bits if power of two

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/FortunaRandomSource.java

    r23ee40d r6ef61063  
    109109        // get at least 4 extra bits if possible for better
    110110        // distribution after the %
     111        // No extra needed if power of two.
    111112        int numBits;
    112         if (n > 0xfffff)
     113        if (n > 0x100000)
    113114            numBits = 31;
    114         else if (n > 0xfff)
     115        else if (n > 0x1000)
    115116            numBits = 24;
    116         else if (n > 0xf)
     117        else if (n > 0x10)
    117118            numBits = 16;
    118119        else
Note: See TracChangeset for help on using the changeset viewer.