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

#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 ;
}