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

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

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