|
Ruby 3.4.5p51 (2025-07-16 revision 20cda200d3ce092571d0b5d342dadca69636cb0f)
|
Arithmetic conversion between C's int and Ruby's. More...
#include "ruby/internal/config.h"#include "ruby/internal/arithmetic/fixnum.h"#include "ruby/internal/arithmetic/intptr_t.h"#include "ruby/internal/arithmetic/long.h"#include "ruby/internal/attr/artificial.h"#include "ruby/internal/attr/const.h"#include "ruby/internal/attr/constexpr.h"#include "ruby/internal/compiler_is.h"#include "ruby/internal/dllexport.h"#include "ruby/internal/special_consts.h"#include "ruby/internal/value.h"#include "ruby/internal/warning_push.h"#include "ruby/assert.h"Go to the source code of this file.
Macros | |
| #define | RB_INT2NUM rb_int2num_inline |
| Just another name of rb_int2num_inline. | |
| #define | RB_NUM2INT rb_num2int_inline |
| Just another name of rb_num2int_inline. | |
| #define | RB_UINT2NUM rb_uint2num_inline |
| Just another name of rb_uint2num_inline. | |
| #define | FIX2INT RB_FIX2INT |
| Old name of RB_FIX2INT. | |
| #define | FIX2UINT RB_FIX2UINT |
| Old name of RB_FIX2UINT. | |
| #define | INT2NUM RB_INT2NUM |
| Old name of RB_INT2NUM. | |
| #define | NUM2INT RB_NUM2INT |
| Old name of RB_NUM2INT. | |
| #define | NUM2UINT RB_NUM2UINT |
| Old name of RB_NUM2UINT. | |
| #define | UINT2NUM RB_UINT2NUM |
| Old name of RB_UINT2NUM. | |
Functions | |
| long | rb_num2int (VALUE num) |
| Converts an instance of rb_cNumeric into C's long. | |
| long | rb_fix2int (VALUE num) |
| Identical to rb_num2int(). | |
| unsigned long | rb_num2uint (VALUE num) |
| Converts an instance of rb_cNumeric into C's unsigned long. | |
| unsigned long | rb_fix2uint (VALUE num) |
| Identical to rb_num2uint(). | |
| static int | RB_FIX2INT (VALUE x) |
| Converts a Fixnum into C's int. | |
| static int | rb_num2int_inline (VALUE x) |
| Converts an instance of rb_cNumeric into C's int. | |
| static unsigned int | RB_NUM2UINT (VALUE x) |
| Converts an instance of rb_cNumeric into C's unsigned int. | |
| static unsigned int | RB_FIX2UINT (VALUE x) |
| Converts a Fixnum into C's int. | |
| static VALUE | rb_int2num_inline (int v) |
| Converts a C's int into an instance of rb_cInteger. | |
| static VALUE | rb_uint2num_inline (unsigned int v) |
| Converts a C's unsigned int into an instance of rb_cInteger. | |
Arithmetic conversion between C's int and Ruby's.
Definition in file int.h.
| #define RB_INT2NUM rb_int2num_inline |
Just another name of rb_int2num_inline.
Definition at line 37 of file int.h.
Referenced by rb_fiber_scheduler_io_result(), rb_fiber_scheduler_process_wait(), rb_io_maybe_wait_readable(), rb_io_maybe_wait_writable(), rb_io_read_check(), and rb_io_wait().
| #define RB_NUM2INT rb_num2int_inline |
Just another name of rb_num2int_inline.
Definition at line 38 of file int.h.
Referenced by rb_fiber_scheduler_io_result_apply(), rb_io_descriptor(), rb_io_maybe_wait_readable(), rb_io_maybe_wait_writable(), rb_io_wait(), and rb_num2char_inline().
| #define RB_UINT2NUM rb_uint2num_inline |
Just another name of rb_uint2num_inline.
Definition at line 39 of file int.h.
Referenced by rb_fiber_scheduler_io_wait_readable(), and rb_fiber_scheduler_io_wait_writable().
|
inlinestatic |
Converts a Fixnum into C's int.
| [in] | x | Some Fixnum. |
Definition at line 129 of file int.h.
Referenced by RB_FIX2INT().
| long rb_fix2int | ( | VALUE | num | ) |
Identical to rb_num2int().
| [in] | num | Something numeric. |
| rb_eTypeError | `num` is not a numeric. |
| rb_eRangeError | `num` is out of range of `int`. |
Definition at line 3350 of file numeric.c.
Referenced by RB_FIX2INT(), rb_fix2int(), and rb_num2int_inline().
|
inlinestatic |
Converts a Fixnum into C's int.
| [in] | x | Some Fixnum. |
Definition at line 208 of file int.h.
Referenced by RB_FIX2UINT().
| unsigned long rb_fix2uint | ( | VALUE | num | ) |
Identical to rb_num2uint().
| [in] | num | Something numeric. |
| rb_eTypeError | `num` is not a numeric. |
| rb_eRangeError | `num` is out of range of `unsigned int`. |
Definition at line 3362 of file numeric.c.
Referenced by RB_FIX2UINT(), and rb_fix2uint().
|
inlinestatic |
Converts a C's int into an instance of rb_cInteger.
| [in] | v | Arbitrary int value. |
| long rb_num2int | ( | VALUE | num | ) |
Converts an instance of rb_cNumeric into C's long.
| [in] | num | Something numeric. |
| rb_eTypeError | `num` is not a numeric. |
| rb_eRangeError | `num` is out of range of `int`. |
Definition at line 3344 of file numeric.c.
Referenced by rb_num2int(), and rb_num2int_inline().
|
inlinestatic |
Converts an instance of rb_cNumeric into C's int.
| [in] | x | Something numeric. |
| rb_eTypeError | `x` is not a numeric. |
| rb_eRangeError | `x` is out of range of `int`. |
|
inlinestatic |
Converts an instance of rb_cNumeric into C's unsigned int.
| [in] | x | Something numeric. |
| rb_eTypeError | `x` is not a numeric. |
| rb_eRangeError | `x` is out of range of `unsigned int`. |
Definition at line 185 of file int.h.
Referenced by RB_NUM2UINT().
| unsigned long rb_num2uint | ( | VALUE | num | ) |
Converts an instance of rb_cNumeric into C's unsigned long.
| [in] | num | Something numeric. |
| rb_eTypeError | `num` is not a numeric. |
| rb_eRangeError | `num` is out of range of `unsigned int`. |
Definition at line 3356 of file numeric.c.
Referenced by RB_NUM2UINT(), and rb_num2uint().
|
inlinestatic |
Converts a C's unsigned int into an instance of rb_cInteger.
| [in] | v | Arbitrary unsigned int value. |