Ruby
3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
|
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. More... | |
#define | RB_NUM2USHORT rb_num2ushort |
Just another name of rb_num2ushort. More... | |
#define | NUM2SHORT RB_NUM2SHORT |
Old name of RB_NUM2SHORT. More... | |
#define | NUM2USHORT RB_NUM2USHORT |
Old name of RB_NUM2USHORT. More... | |
#define | USHORT2NUM RB_INT2FIX |
Old name of RB_INT2FIX. More... | |
#define | RB_FIX2SHORT rb_fix2short |
Just another name of rb_fix2ushort. More... | |
#define | FIX2SHORT RB_FIX2SHORT |
Old name of RB_FIX2SHORT. More... | |
Functions | |
short | rb_num2short (VALUE num) |
Converts an instance of rb_cNumeric into C's short . More... | |
unsigned short | rb_num2ushort (VALUE num) |
Converts an instance of rb_cNumeric into C's unsigned short . More... | |
short | rb_fix2short (VALUE num) |
Identical to rb_num2short(). More... | |
unsigned short | rb_fix2ushort (VALUE num) |
Identical to rb_num2ushort(). More... | |
static short | rb_num2short_inline (VALUE x) |
Identical to rb_num2short(). More... | |
Arithmetic conversion between C's short
and Ruby's.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.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 . |
short
. Definition at line 3409 of file numeric.c.
Referenced by 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 . |
unsigned short
. 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 . |
short
. Definition at line 3400 of file numeric.c.
Referenced by 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 . |
short
. 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 . |
unsigned short
. Definition at line 3418 of file numeric.c.
Referenced by rb_fix2ushort().