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

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

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