BN_div function

  1. @RecordUse.new()
  2. @Native<Int Function(Pointer<BIGNUM>, Pointer<BIGNUM>, Pointer<BIGNUM>, Pointer<BIGNUM>, Pointer<BN_CTX>)>(ffi.Pointer<BIGNUM>, ffi.Pointer<BIGNUM>, ffi.Pointer<BIGNUM>, ffi.Pointer<BIGNUM>, ffi.Pointer<BN_CTX>)>(symbol: 'bssl_dart_BN_div')
int BN_div(
  1. Pointer<BIGNUM> quotient,
  2. Pointer<BIGNUM> rem,
  3. Pointer<BIGNUM> numerator,
  4. Pointer<BIGNUM> divisor,
  5. Pointer<BN_CTX> ctx,
)

BN_div divides numerator by divisor and places the result in quotient and the remainder in rem. Either of quotient or rem may be NULL, in which case the respective value is not returned. It returns one on success or zero on error. It is an error condition if divisor is zero.

The outputs will be such that quotient * divisor + rem = numerator, with the quotient rounded towards zero. Thus, if numerator is negative, rem will be zero or negative. If divisor is negative, the sign of quotient will be flipped to compensate but otherwise rounding will be as if divisor were its absolute value.

Implementation

@meta.RecordUse()
@ffi.Native<
  ffi.Int Function(
    ffi.Pointer<BIGNUM>,
    ffi.Pointer<BIGNUM>,
    ffi.Pointer<BIGNUM>,
    ffi.Pointer<BIGNUM>,
    ffi.Pointer<BN_CTX>,
  )
>(symbol: 'bssl_dart_BN_div')
external int BN_div(
  ffi.Pointer<BIGNUM> quotient,
  ffi.Pointer<BIGNUM> rem,
  ffi.Pointer<BIGNUM> numerator,
  ffi.Pointer<BIGNUM> divisor,
  ffi.Pointer<BN_CTX> ctx,
);