Ruby: include/ruby/internal/arithmetic/short.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

short.h
Go to the documentation of this file.
1#ifndef RBIMPL_ARITHMETIC_SHORT_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ARITHMETIC_SHORT_H
26#include "ruby/internal/value.h"
27#include "ruby/internal/dllexport.h"
28#include "ruby/internal/special_consts.h"
29
30#define RB_NUM2SHORT rb_num2short_inline
31#define RB_NUM2USHORT rb_num2ushort
32#define NUM2SHORT RB_NUM2SHORT
33#define NUM2USHORT RB_NUM2USHORT
34#define USHORT2NUM RB_INT2FIX
35#define RB_FIX2SHORT rb_fix2short
36#define FIX2SHORT RB_FIX2SHORT
37
38 RBIMPL_SYMBOL_EXPORT_BEGIN()
39short rb_num2short(VALUE);
40unsigned short rb_num2ushort(VALUE);
41short rb_fix2short(VALUE);
42unsigned short rb_fix2ushort(VALUE);
43 RBIMPL_SYMBOL_EXPORT_END()
44
45static inline short
46rb_num2short_inline(VALUE x)
47{
48 if (RB_FIXNUM_P(x))
49 return rb_fix2short(x);
50 else
51 return rb_num2short(x);
52}
53
54#endif /* RBIMPL_ARITHMETIC_SOHRT_H */
dllexport.h
Tewaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:86
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:77
rb_fix2ushort
unsigned short rb_fix2ushort(VALUE)
Definition: numeric.c:3126
rb_fix2short
short rb_fix2short(VALUE)
Definition: numeric.c:3107
rb_num2short
short rb_num2short(VALUE)
Definition: numeric.c:3098
rb_num2ushort
unsigned short rb_num2ushort(VALUE)
Definition: numeric.c:3116
special_consts.h
Defines enum ruby_special_consts.
value.h
Defines VALUE and ID.
VALUE
unsigned long VALUE
Definition: value.h:38