Java Array Multiply multiplyP8(int[] x)

Here you can find the source of multiplyP8(int[] x)

Description

multiply P

License

Open Source License

Declaration

static void multiplyP8(int[] x) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static void multiplyP8(int[] x) {
        //        for (int i = 8; i != 0; --i)
        //        {
        //            multiplyP(x);
        //        }

        int lsw = x[3];
        shiftRightN(x, 8);//  ww  w.ja v  a 2  s  .co  m
        for (int i = 7; i >= 0; --i) {
            if ((lsw & (1 << i)) != 0) {
                x[0] ^= (0xe1000000 >>> (7 - i));
            }
        }
    }

    static void multiplyP8(int[] x, int[] output) {
        int lsw = x[3];
        shiftRightN(x, 8, output);
        for (int i = 7; i >= 0; --i) {
            if ((lsw & (1 << i)) != 0) {
                output[0] ^= (0xe1000000 >>> (7 - i));
            }
        }
    }

    static void shiftRightN(int[] block, int n) {
        int i = 0;
        int bits = 0;
        for (;;) {
            int b = block[i];
            block[i] = (b >>> n) | bits;
            if (++i == 4) {
                break;
            }
            bits = b << (32 - n);
        }
    }

    static void shiftRightN(int[] block, int n, int[] output) {
        int i = 0;
        int bits = 0;
        for (;;) {
            int b = block[i];
            output[i] = (b >>> n) | bits;
            if (++i == 4) {
                break;
            }
            bits = b << (32 - n);
        }
    }
}

Related

  1. multiplyP(int[] x)
  2. multiplyP(int[] x)
  3. multiplyP(int[] x)
  4. multiplyP(int[] x)
  5. multiplyP8(int[] x)
  6. MultiplyPointSimilarityInhomogenous(double[] xp, int idx, double[] H, double[] x, int idx2)
  7. multiplyRange(double[] accumulator, int offset, double[] modulator)
  8. multiplyScalar(double[] a, double value)
  9. multiplyScalarInPlace(double[] a, double value)