This uses inc/dec if b is in the range of int32 (which avoids allocating a temporary BigInt), at the cost of an additonal range check. I chose to not change the type from int to int32, since succ/prec for Ordinals also take an int (we might want to make inc/dec take an int as well for the same reason). Although if you prefer taking an int32, I can happily change that.
This uses
inc
/dec
ifb
is in the range ofint32
(which avoids allocating a temporaryBigInt
), at the cost of an additonal range check. I chose to not change the type fromint
toint32
, sincesucc
/prec
forOrdinal
s also take anint
(we might want to makeinc
/dec
take anint
as well for the same reason). Although if you prefer taking anint32
, I can happily change that.