lopy4/components/Bliss-master/ntt_variants/ntt.c
/*
 * Bit-reverse shuffle: generic form
 */
Bit-reverse shuffle: generic form
Bit - reverse shuffle : generic form
void bitrev_shuffle(int32_t *a, uint32_t n) {
  uint32_t i, j, k;
  int32_t x;
  assert(n > 0 && (n & (n - 1)) == 0); 
  j = n>>1;
  for (i=1; i<n-1; i++) {
    if (i < j) {
      x = a[i]; a[i] = a[j]; a[j] = x;
    }
    k = n;
    do {
      k >>= 1;
      j ^= k;
    } while ((j & k) == 0);
  }
}
void bitrev_shuffle ( int32_t * a , uint32_t n ) { uint32_t i , j , k ; int32_t x ; assert ( n > 0 && ( n & ( n - 1 ) ) == 0 ) ; j = n >> 1 ; for ( i = 1 ; i < n - 1 ; i ++ ) { if ( i < j ) { x = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = x ; } k = n ; do { k >>= 1 ; j ^= k ; } while ( ( j & k ) == 0 ) ; } }
Bit-reverse shuffle: generic form
Bit - reverse shuffle : generic form
// n must be a power of 2