summaryrefslogtreecommitdiff
path: root/src/libbiguint/bu_srbc.c
blob: 5e1fbc4a5a4d88eb9271a3d7d2e61c97c54baec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <stdint.h>
#include <skalibs/biguint.h>

int bu_srbc (uint32_t *a, unsigned int n, int carry)
{
  while (n--)
  {
    int c = a[n] & 1 ;
    a[n] = (a[n] >> 1) | (carry ? 0x80000000U : 0) ;
    carry = c ;
  }
  return carry ;
}