Ruby 3.4.5p51 (2025-07-16 revision 20cda200d3ce092571d0b5d342dadca69636cb0f)
|
Arithmetic conversion between C's short and Ruby's. More...
#include "ruby/internal/value.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/special_consts.h"
Go to the source code of this file.
Macros | |
#define | RB_NUM2SHORT rb_num2short_inline |
Just another name of rb_num2short_inline. | |
#define | RB_NUM2USHORT rb_num2ushort |
Just another name of rb_num2ushort. | |
#define | NUM2SHORT RB_NUM2SHORT |
Old name of RB_NUM2SHORT. | |
#define | NUM2USHORT RB_NUM2USHORT |
Old name of RB_NUM2USHORT. | |
#define | USHORT2NUM RB_INT2FIX |
Old name of RB_INT2FIX. | |
#define | RB_FIX2SHORT rb_fix2short |
Just another name of rb_fix2ushort. | |
#define | FIX2SHORT RB_FIX2SHORT |
Old name of RB_FIX2SHORT. |
Functions | |
short | rb_num2short (VALUE num) |
Converts an instance of rb_cNumeric into C's short. | |
unsigned short | rb_num2ushort (VALUE num) |
Converts an instance of rb_cNumeric into C's unsigned short. | |
short | rb_fix2short (VALUE num) |
Identical to rb_num2short(). | |
unsigned short | rb_fix2ushort (VALUE num) |
Identical to rb_num2ushort(). | |
static short | rb_num2short_inline (VALUE x) |
Identical to rb_num2short(). |
Arithmetic conversion between C's short and Ruby's.
Shyouhei wonders: why there is no SHORT2NUM, given there are both USHORT2NUM and CHR2FIX?
Definition in file short.h.
#define RB_FIX2SHORT rb_fix2short |
Just another name of rb_fix2ushort.
#define RB_NUM2SHORT rb_num2short_inline |
Just another name of rb_num2short_inline.
#define RB_NUM2USHORT rb_num2ushort |
Just another name of rb_num2ushort.
short rb_fix2short | ( | VALUE | num | ) |
Identical to rb_num2short().
[in] | num | Something numeric. |
rb_eTypeError | `num` is not a numeric. |
rb_eRangeError | `num` is out of range of `short`. |
Definition at line 3409 of file numeric.c.
Referenced by rb_fix2short(), and rb_num2short_inline().
unsigned short rb_fix2ushort | ( | VALUE | num | ) |
Identical to rb_num2ushort().
[in] | num | Something numeric. |
rb_eTypeError | `num` is not a numeric. |
rb_eRangeError | `num` is out of range of `unsigned short`. |
Definition at line 3428 of file numeric.c.
Referenced by rb_fix2ushort().
short rb_num2short | ( | VALUE | num | ) |
Converts an instance of rb_cNumeric into C's short.
[in] | num | Something numeric. |
rb_eTypeError | `num` is not a numeric. |
rb_eRangeError | `num` is out of range of `short`. |
Definition at line 3400 of file numeric.c.
Referenced by rb_num2short(), and rb_num2short_inline().
|
inlinestatic |
Identical to rb_num2short().
[in] | x | Something numeric. |
rb_eTypeError | `x` is not a numeric. |
rb_eRangeError | `x` is out of range of `short`. |
Definition at line 105 of file short.h.
Referenced by rb_num2short_inline().
unsigned short rb_num2ushort | ( | VALUE | num | ) |
Converts an instance of rb_cNumeric into C's unsigned short.
[in] | num | Something numeric. |
rb_eTypeError | `num` is not a numeric. |
rb_eRangeError | `num` is out of range of `unsigned short`. |
Definition at line 3418 of file numeric.c.
Referenced by rb_fix2ushort(), and rb_num2ushort().