Ruby: include/ruby/internal/core/rbignum.h Source File

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

rbignum.h
Go to the documentation of this file.
1#ifndef RBIMPL_RBIGNUM_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_RBIGNUM_H
23#include "ruby/internal/dllexport.h"
24#include "ruby/internal/value.h"
25#include "ruby/internal/value_type.h"
26#include "ruby/internal/stdbool.h"
27
28#define RBIGNUM_SIGN rb_big_sign
29
31#define RBIGNUM_POSITIVE_P RBIGNUM_POSITIVE_P
32#define RBIGNUM_NEGATIVE_P RBIGNUM_NEGATIVE_P
35 RBIMPL_SYMBOL_EXPORT_BEGIN()
36 int rb_big_sign(VALUE num);
37 RBIMPL_SYMBOL_EXPORT_END()
38
39static inline bool
40RBIGNUM_POSITIVE_P(VALUE b) {
41 RBIMPL_ASSERT_TYPE(b, RUBY_T_BIGNUM);
42 return RBIGNUM_SIGN(b);
43}
44
45static inline bool
46RBIGNUM_NEGATIVE_P(VALUE b) {
47 RBIMPL_ASSERT_TYPE(b, RUBY_T_BIGNUM);
48 return ! RBIGNUM_POSITIVE_P(b);
49}
50
51#endif /* RBIMPL_RBIGNUM_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
num
big_t * num
Definition: enough.c:232
int
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
RBIGNUM_SIGN
#define RBIGNUM_SIGN
Definition: rbignum.h:28
rb_big_sign
int rb_big_sign(VALUE num)
Definition: bignum.c:6769
stdbool.h
C99 shim for <stdbool.h>
value.h
Defines VALUE and ID.
VALUE
unsigned long VALUE
Definition: value.h:38
value_type.h
Defines enum ruby_value_type.
RUBY_T_BIGNUM
@ RUBY_T_BIGNUM
Definition: value_type.h:122