public class DivideJc
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| int | qQuotient and remainder. | 
| int | rQuotient and remainder. | 
| static int | versionVersion, history and license. | 
| Constructor and Description | 
|---|
| DivideJc(int q,
        int r) | 
| Modifier and Type | Method and Description | 
|---|---|
| static DivideJc | divLess2pow(int val,
           int bit1,
           int bit2)This algorithm can be used if a number should be divide by a divisor which is near but less
 a power of 2 value and the divisor is build in a special simple form. | 
| static void | main(java.lang.String[] args)Only for test in debug mode. | 
| java.lang.String | toString() | 
public static final int version
public int q
public int r
public static DivideJc divLess2pow(int val, int bit1, int bit2)
y = x / 1.9 ~= x / 2.0 + (x/2.0) * (2.0-1.9)/2.0;One can divide by 2.0 instead divide by 1.9, then adjust the result with the ratio of abbreviation.
bit1 bit2 divisor 10 2 0x03fc = 0x0400 - 0x0004 10 6 0x03c0 = 0x0400 - 0x0040 10 8 0x0300 = 0x0400 - 0x0100 12 2 0x0ffc = 0x1000 - 0x0004 12 6 0x0fc0 = 0x1000 - 0x0040 12 8 0x0f00 = 0x1000 - 0x0100 12 10 0x0c00 = 0x1000 - 0x0400This algorithm is used to calculate indices of arrays in a
IntegerBlockArray
 which has a size less a power of 2 because it can be used with the BlockHeap concept in C language.val - Any integer value, the dividend.bit1 - The bit which describes the nearest power of 2 of divisor. (1<bit2 - The bit which describes the distance from the nearest power of 2. 1<public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
args - not used.