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

Ruby 3.4.4p34 (2025-05-14 revision a38531fd3f617bf734ef7d6c595325f69985ea1d)

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
30
32#define RBIGNUM_POSITIVE_P RBIGNUM_POSITIVE_P
33#define RBIGNUM_NEGATIVE_P RBIGNUM_NEGATIVE_P
35
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:74
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:65
inline
#define inline
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
Definition defines.h:88
RBIGNUM_SIGN
#define RBIGNUM_SIGN
Just another name of rb_big_sign.
Definition rbignum.h:29
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:125