Ah, so, by the way, 10bit-out-of-20bit-set generator attached.

On 15.07.2016 04:54, Henry Barton wrote:
> I’m designing a CDMA system with a spreading factor of 20. I recently
> wrote an app to go through all the binary permutations up to 2^20 and
> report which ones have an equal number of 0’s and 1’s, or at least
> differ by only one. It came up with so many “hits” that I have to
> wonder if they're really orthogonal. Does anyone know offhand how many
> good spreading codes I can realistically expect from 1048576 possible
> entries?
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

#include <stdint.h>
#include <stdio.h>

int main(){
  /* Get all 20 bit values with 10 bit set;
   * based on 
https://graphics.stanford.edu/~seander/bithacks.html#NextBitPermutation
   */
  uint32_t first = 0x3FF; // 10 binary ones
  uint32_t v = first;
  while(v < (first << 10)){
    printf("0x%05X, ", v);
    uint32_t t = (v | (v - 1)) + 1;
    v = t | ((((t & -t) / (v & -v)) >> 1) - 1);
  }
}
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to