Ruby  3.4.0dev (2024-11-05 revision 348a53415339076afc4a02fcd09f3ae36e9c4c61)
Macros | Functions
long_long.h File Reference

(348a53415339076afc4a02fcd09f3ae36e9c4c61)

Arithmetic conversion between C's long long and Ruby's. More...

#include "ruby/internal/value.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/special_consts.h"
#include "ruby/backward/2/long_long.h"
Include dependency graph for long_long.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RB_LL2NUM   rb_ll2num_inline
 Just another name of rb_ll2num_inline. More...
 
#define RB_ULL2NUM   rb_ull2num_inline
 Just another name of rb_ull2num_inline. More...
 
#define LL2NUM   RB_LL2NUM
 Old name of RB_LL2NUM. More...
 
#define ULL2NUM   RB_ULL2NUM
 Old name of RB_ULL2NUM. More...
 
#define RB_NUM2LL   rb_num2ll_inline
 Just another name of rb_num2ll_inline. More...
 
#define RB_NUM2ULL   rb_num2ull_inline
 Just another name of rb_num2ull_inline. More...
 
#define NUM2LL   RB_NUM2LL
 Old name of RB_NUM2LL. More...
 
#define NUM2ULL   RB_NUM2ULL
 Old name of RB_NUM2ULL. More...
 

Functions

VALUE rb_ll2inum (LONG_LONG num)
 Converts a C's long long into an instance of rb_cInteger. More...
 
VALUE rb_ull2inum (unsigned LONG_LONG num)
 Converts a C's unsigned long long into an instance of rb_cInteger. More...
 
LONG_LONG rb_num2ll (VALUE num)
 Converts an instance of rb_cNumeric into C's long long. More...
 
unsigned LONG_LONG rb_num2ull (VALUE num)
 Converts an instance of rb_cNumeric into C's unsigned long long. More...
 
static VALUE rb_ll2num_inline (LONG_LONG n)
 Converts a C's long long into an instance of rb_cInteger. More...
 
static VALUE rb_ull2num_inline (unsigned LONG_LONG n)
 Converts a C's unsigned long long into an instance of rb_cInteger. More...
 
static LONG_LONG rb_num2ll_inline (VALUE x)
 Converts an instance of rb_cNumeric into C's long long. More...
 
static unsigned LONG_LONG rb_num2ull_inline (VALUE x)
 Converts an instance of rb_cNumeric into C's unsigned long long. More...
 

Detailed Description

Arithmetic conversion between C's long long and Ruby's.

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 long_long.h.

Macro Definition Documentation

◆ RB_LL2NUM

#define RB_LL2NUM   rb_ll2num_inline

Just another name of rb_ll2num_inline.

Definition at line 28 of file long_long.h.

◆ RB_NUM2LL

#define RB_NUM2LL   rb_num2ll_inline

Just another name of rb_num2ll_inline.

Definition at line 32 of file long_long.h.

◆ RB_NUM2ULL

#define RB_NUM2ULL   rb_num2ull_inline

Just another name of rb_num2ull_inline.

Definition at line 33 of file long_long.h.

◆ RB_ULL2NUM

#define RB_ULL2NUM   rb_ull2num_inline

Just another name of rb_ull2num_inline.

Definition at line 29 of file long_long.h.

Function Documentation

◆ rb_ll2inum()

VALUE rb_ll2inum ( LONG_LONG  num)

Converts a C's long long into an instance of rb_cInteger.

Parameters
[in]numArbitrary long long value.
Returns
An instance of rb_cInteger.

Referenced by rb_ll2num_inline().

◆ rb_ll2num_inline()

static VALUE rb_ll2num_inline ( LONG_LONG  n)
inlinestatic

Converts a C's long long into an instance of rb_cInteger.

Parameters
[in]nArbitrary long long value.
Returns
An instance of rb_cInteger

Definition at line 82 of file long_long.h.

◆ rb_num2ll()

LONG_LONG rb_num2ll ( VALUE  num)

Converts an instance of rb_cNumeric into C's long long.

Parameters
[in]numSomething numeric.
Exceptions
rb_eTypeErrornum is not a numeric.
rb_eRangeErrornum is out of range of long long.
Returns
The passed value converted into C's long long.

Referenced by rb_num2ll_inline().

◆ rb_num2ll_inline()

static LONG_LONG rb_num2ll_inline ( VALUE  x)
inlinestatic

Converts an instance of rb_cNumeric into C's long long.

Parameters
[in]xSomething numeric.
Exceptions
rb_eTypeErrorx is not a numeric.
rb_eRangeErrorx is out of range of long long.
Returns
The passed value converted into C's long long.

Definition at line 110 of file long_long.h.

◆ rb_num2ull()

unsigned LONG_LONG rb_num2ull ( VALUE  num)

Converts an instance of rb_cNumeric into C's unsigned long long.

Parameters
[in]numSomething numeric.
Exceptions
rb_eTypeErrornum is not a numeric.
rb_eRangeErrornum is out of range of unsigned long long.
Returns
The passed value converted into C's unsigned long long.

Referenced by rb_num2ull_inline().

◆ rb_num2ull_inline()

static unsigned LONG_LONG rb_num2ull_inline ( VALUE  x)
inlinestatic

Converts an instance of rb_cNumeric into C's unsigned long long.

Parameters
[in]xSomething numeric.
Exceptions
rb_eTypeErrorx is not a numeric.
rb_eRangeErrorx is out of range of unsigned long long.
Returns
The passed value converted into C's unsigned long long.

Definition at line 127 of file long_long.h.

◆ rb_ull2inum()

VALUE rb_ull2inum ( unsigned LONG_LONG  num)

Converts a C's unsigned long long into an instance of rb_cInteger.

Parameters
[in]numArbitrary unsigned long long value.
Returns
An instance of rb_cInteger.

Referenced by rb_ull2num_inline().

◆ rb_ull2num_inline()

static VALUE rb_ull2num_inline ( unsigned LONG_LONG  n)
inlinestatic

Converts a C's unsigned long long into an instance of rb_cInteger.

Parameters
[in]nArbitrary unsigned long long value.
Returns
An instance of rb_cInteger

Definition at line 95 of file long_long.h.