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