summaryrefslogtreecommitdiff
path: root/src/libbiguint/bu_srbc.c
blob: a2dbab5ac9e35fb906bde6c0b47fbc15da509ac7 (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 (register uint32_t *a, register unsigned int n, register int carry)
{
  while (n--)
  {
    register int c = a[n] & 1 ;
    a[n] = (a[n] >> 1) | (carry ? 0x80000000U : 0) ;
    carry = c ;
  }
  return carry ;
}