6 Ruby.primitive :bignum_invert
7 raise PrimitiveFailure, "Bignum#~ primitive failed"
11 Ruby.primitive :bignum_neg
12 raise PrimitiveFailure, "Bignum#-@ primitive failed"
15 # binary math operators
18 Ruby.primitive :bignum_add
23 Ruby.primitive :bignum_sub
28 Ruby.primitive :bignum_mul
32 # this method is aliased to / in core
33 # see README-DEVELOPERS regarding safe math compiler plugin
35 Ruby.primitive :bignum_div
40 Ruby.primitive :bignum_divmod
44 def mod_primitive(other)
45 Ruby.primitive :bignum_mod
46 raise PrimitiveFailure, "primitive failed"
49 # bitwise binary operators
52 Ruby.primitive :bignum_and
57 Ruby.primitive :bignum_or
62 Ruby.primitive :bignum_xor
66 def __bignum_left_shift__(s)
67 Ruby.primitive :bignum_left_shift
68 raise PrimitiveFailure, "primitive failed"
71 def __bignum_right_shift__(s)
72 Ruby.primitive :bignum_right_shift
73 raise PrimitiveFailure, "primitive failed"
76 # comparison operators
79 Ruby.primitive :bignum_lt
84 Ruby.primitive :bignum_le
89 Ruby.primitive :bignum_gt
94 Ruby.primitive :bignum_ge
99 Ruby.primitive :bignum_equal
104 Ruby.primitive :bignum_compare
110 def self.from_float(value)
111 Ruby.primitive :bignum_from_float
112 raise PrimitiveFailure, "Bignum.from_float primitive failed"
116 Ruby.primitive :bignum_to_float
117 raise PrimitiveFailure, "Bignum#to_f primitive failed"
120 def radix_to_s(radix)
121 Ruby.primitive :bignum_to_s
122 raise PrimitiveFailure, "Bignum#radix_to_s primitive failed"
126 raise ArgumentError, 'base must be between 2 and 36' unless
127 radix.between?(2, 36)
136 Ruby.primitive :bignum_size
137 raise PrimitiveFailure, "Bignum#size primitive failed"