Ledger Nano X - The secure hardware wallet
SHARE
TWEET

nibble_sort_word2

a guest Jan 28th, 2015 272 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unsigned long nibble_sort_word2(unsigned long arg)
  2. {
  3.     int i, j;
  4.     unsigned long counter[16] = {0};
  5.  
  6.     for (i = 0; i < 16; i++) {
  7.         counter[read_nibble(arg, i)]++;
  8.     }
  9.  
  10.     // Loop through all the buckets
  11.     for (i = 0, j = 0; i < 16; i++) {
  12.         while (counter[i]--) {
  13.             write_nibble(&arg, j++, i);
  14.         }
  15.     }
  16.  
  17.     return arg;
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top