Ruby: include/ruby/internal/arithmetic/int.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions
int.h File Reference

Arithmetic conversion between C's `int` and Ruby's. More...

`#include "ruby/internal/config.h"`
`#include "ruby/internal/arithmetic/fixnum.h"`
`#include "ruby/internal/arithmetic/intptr_t.h"`
`#include "ruby/internal/arithmetic/long.h"`
`#include "ruby/internal/attr/artificial.h"`
`#include "ruby/internal/attr/const.h"`
`#include "ruby/internal/attr/constexpr.h"`
`#include "ruby/internal/compiler_is.h"`
`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/special_consts.h"`
`#include "ruby/internal/value.h"`
`#include "ruby/internal/warning_push.h"`
`#include "ruby/assert.h"`

Go to the source code of this file.

## Macros
#define | RB_INT2NUM rb_int2num_inline
#define | RB_NUM2INT rb_num2int_inline
#define | RB_UINT2NUM rb_uint2num_inline
#define | FIX2INT RB_FIX2INT
#define | FIX2UINT RB_FIX2UINT
#define | INT2NUM RB_INT2NUM
#define | NUM2INT RB_NUM2INT
#define | NUM2UINT RB_NUM2UINT
#define | UINT2NUM RB_UINT2NUM

## Functions
long | rb_num2int (VALUE)
long | rb_fix2int (VALUE)
unsigned long | rb_num2uint (VALUE)
unsigned long | rb_fix2uint (VALUE)

## Detailed Description

Arithmetic conversion between C's `int` and Ruby's.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

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

## Macro Definition Documentation

## ◆ FIX2INT

#define FIX2INT RB_FIX2INT

Definition at line 41 of file int.h.

## ◆ FIX2UINT

#define FIX2UINT RB_FIX2UINT

Definition at line 42 of file int.h.

## ◆ INT2NUM

#define INT2NUM RB_INT2NUM

Definition at line 43 of file int.h.

## ◆ NUM2INT

#define NUM2INT RB_NUM2INT

Definition at line 44 of file int.h.

## ◆ NUM2UINT

#define NUM2UINT RB_NUM2UINT

Definition at line 45 of file int.h.

## ◆ RB_INT2NUM

#define RB_INT2NUM rb_int2num_inline

Definition at line 37 of file int.h.

## ◆ RB_NUM2INT

#define RB_NUM2INT rb_num2int_inline

Definition at line 38 of file int.h.

## ◆ RB_UINT2NUM

#define RB_UINT2NUM rb_uint2num_inline

Definition at line 39 of file int.h.

## ◆ UINT2NUM

#define UINT2NUM RB_UINT2NUM

Definition at line 46 of file int.h.

## Function Documentation

## ◆ rb_fix2int()

long rb_fix2int | ( | VALUE | val | ) |

Definition at line 3048 of file numeric.c.

References FIX2INT.

## ◆ rb_fix2uint()

unsigned long rb_fix2uint | ( | VALUE | val | ) |

Definition at line 3060 of file numeric.c.

References RB_FIX2ULONG.

## ◆ rb_num2int()

long rb_num2int | ( | VALUE | val | ) |

Definition at line 3042 of file numeric.c.

References rb_num2long().

## ◆ rb_num2uint()

unsigned long rb_num2uint | ( | VALUE | val | ) |

Definition at line 3054 of file numeric.c.

References rb_num2ulong().