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

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

rbignum.h
Go to the documentation of this file.
1#ifndef RBIMPL_RBIGNUM_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_RBIGNUM_H
24#include "ruby/internal/dllexport.h"
25#include "ruby/internal/value.h"
26#include "ruby/internal/value_type.h"
27#include "ruby/internal/stdbool.h"
28
29#define RBIGNUM_SIGN rb_big_sign
32#define RBIGNUM_POSITIVE_P RBIGNUM_POSITIVE_P
33#define RBIGNUM_NEGATIVE_P RBIGNUM_NEGATIVE_P
36 RBIMPL_SYMBOL_EXPORT_BEGIN()
51int rb_big_sign(VALUE num);
52 RBIMPL_SYMBOL_EXPORT_END()
53
60static inline bool
61RBIGNUM_POSITIVE_P(VALUE b)
62{
63 RBIMPL_ASSERT_TYPE(b, RUBY_T_BIGNUM);
64 return RBIGNUM_SIGN(b);
65}
66
73static inline bool
74RBIGNUM_NEGATIVE_P(VALUE b)
75{
76 RBIMPL_ASSERT_TYPE(b, RUBY_T_BIGNUM);
77 return ! RBIGNUM_POSITIVE_P(b);
78}
79
80#endif /* RBIMPL_RBIGNUM_H */
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:106
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:97
RBIGNUM_SIGN
#define RBIGNUM_SIGN
Just another name of rb_big_sign.
Definition rbignum.h:29
rb_big_sign
int rb_big_sign(VALUE num)
The "sign" of a bignum.
Definition bignum.c:6790
RBIGNUM_NEGATIVE_P
static bool RBIGNUM_NEGATIVE_P(VALUE b)
Checks if the bignum is negative.
Definition rbignum.h:74
RBIGNUM_POSITIVE_P
static bool RBIGNUM_POSITIVE_P(VALUE b)
Checks if the bignum is positive.
Definition rbignum.h:61
stdbool.h
C99 shim for <stdbool.h>
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40
value_type.h
Defines enum ruby_value_type.
RUBY_T_BIGNUM
@ RUBY_T_BIGNUM
Definition value_type.h:124