Ruby  3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
Macros
fixnum.h File Reference

(0989400a925cd201defdca9eb28eb87200b30785)

Handling of integers formerly known as Fixnums. More...

#include "ruby/backward/2/limits.h"
Include dependency graph for fixnum.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FIXABLE   RB_FIXABLE
 Old name of RB_FIXABLE. More...
 
#define FIXNUM_MAX   RUBY_FIXNUM_MAX
 Old name of RUBY_FIXNUM_MAX. More...
 
#define FIXNUM_MIN   RUBY_FIXNUM_MIN
 Old name of RUBY_FIXNUM_MIN. More...
 
#define NEGFIXABLE   RB_NEGFIXABLE
 Old name of RB_NEGFIXABLE. More...
 
#define POSFIXABLE   RB_POSFIXABLE
 Old name of RB_POSFIXABLE. More...
 
#define RB_POSFIXABLE(_)   ((_) < RUBY_FIXNUM_MAX + 1)
 Checks if the passed value is in range of fixnum, assuming it is a positive number. More...
 
#define RB_NEGFIXABLE(_)   ((_) >= RUBY_FIXNUM_MIN)
 Checks if the passed value is in range of fixnum, assuming it is a negative number. More...
 
#define RB_FIXABLE(_)   (RB_POSFIXABLE(_) && RB_NEGFIXABLE(_))
 Checks if the passed value is in range of fixnum. More...
 
#define RUBY_FIXNUM_MAX   (LONG_MAX / 2)
 Maximum possible value that a fixnum can represent. More...
 
#define RUBY_FIXNUM_MIN   (LONG_MIN / 2)
 Minimum possible value that a fixnum can represent. More...
 

Detailed Description

Handling of integers formerly known as Fixnums.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file fixnum.h.

Macro Definition Documentation

◆ RB_FIXABLE

#define RB_FIXABLE (   _)    (RB_POSFIXABLE(_) && RB_NEGFIXABLE(_))

Checks if the passed value is in range of fixnum.

Definition at line 52 of file fixnum.h.

◆ RB_NEGFIXABLE

#define RB_NEGFIXABLE (   _)    ((_) >= RUBY_FIXNUM_MIN)

Checks if the passed value is in range of fixnum, assuming it is a negative number.

This is an implementation of RB_FIXABLE. Rarely used stand alone.

Definition at line 49 of file fixnum.h.

◆ RB_POSFIXABLE

#define RB_POSFIXABLE (   _)    ((_) < RUBY_FIXNUM_MAX + 1)

Checks if the passed value is in range of fixnum, assuming it is a positive number.

Can sometimes be useful for C's unsigned integer types.

Definition at line 43 of file fixnum.h.

◆ RUBY_FIXNUM_MAX

#define RUBY_FIXNUM_MAX   (LONG_MAX / 2)

Maximum possible value that a fixnum can represent.

Definition at line 55 of file fixnum.h.

◆ RUBY_FIXNUM_MIN

#define RUBY_FIXNUM_MIN   (LONG_MIN / 2)

Minimum possible value that a fixnum can represent.

Definition at line 58 of file fixnum.h.