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

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

int bu_slbc (register uint32 *a, register unsigned int n, register int carry)
{
  register unsigned int i = 0 ;
  carry = !!carry ;
  for (; i < n ; i++)
  {
    register int c = a[i] >> 31 ;
    a[i] = (a[i] << 1) | carry ;
    carry = c ;
  }
  return carry ;
}