Here you can find the source of transposeValue(long[] valSet, int DEPTH)
Parameter | Description |
---|---|
valSet | vector |
DEPTH | total number of bits, usually 64 |
public static long[] transposeValue(long[] valSet, int DEPTH)
//package com.java2s; /*/*from w ww . ja v a 2s. c om*/ * Copyright 2011-2016 ETH Zurich. All Rights Reserved. * * This software is the proprietary information of ETH Zurich. * Use is subject to license terms. */ public class Main { /** * Transpose the value from long[DIM] to long[DEPTH]. * Transposition occurs such that high-order bits end up in the first value of 'tv'. * Value from DIM=0 end up as highest order bits in 'tv'. * 0001, * 0010, * 0011 * becomes * 000, 000, 011, 101 * * @param valSet vector * @param DEPTH total number of bits, usually 64 * @return Transposed value */ public static long[] transposeValue(long[] valSet, int DEPTH) { long[] tv = new long[DEPTH]; long valMask = 1L << (DEPTH - 1); int rightShift = DEPTH - 1; for (int j = 0; j < DEPTH; j++) { long pos = 0; for (long v : valSet) { pos <<= 1; //set pos-bit if bit is set in value // if ((valMask & v) != 0) { // pos |= 1L; // } pos |= (valMask & v) >>> rightShift; } tv[j] = pos; valMask >>>= 1; rightShift--; } return tv; } }