Ruby 4.1.0dev (2026-10-09 revision 334b4ffa7fa75c5e347799a7609c252abe68df30)
Macros | Functions
len_t.h File Reference

(334b4ffa7fa75c5e347799a7609c252abe68df30)

Arithmetic conversion between rb_len_t and Ruby's. More...

#include "ruby/internal/config.h"
#include "ruby/internal/arithmetic/long.h"
#include "ruby/internal/assume.h"
#include "ruby/internal/cast.h"
#include "ruby/internal/value.h"
Include dependency graph for len_t.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LEN2NUM   RB_LEN2NUM
 Old name of RB_LEN2NUM.
 
#define NUM2LEN   RB_NUM2LEN
 Old name of RB_NUM2LEN.
 
#define ULEN2NUM   RB_ULEN2NUM
 Old name of RB_ULEN2NUM.
 
#define rb_len2int   rb_len2int_inline
 Just another name of rb_len2int_inline.
 
#define RB_LEN2NUM   RB_LONG2NUM
 Converts a rb_len_t into an instance of rb_cInteger.
 
#define RB_NUM2LEN   RB_NUM2LONG
 Converts an instance of rb_cNumeric into rb_len_t.
 
#define RB_ULEN2NUM   RB_ULONG2NUM
 Converts a rb_ulen_t into an instance of rb_cInteger.
 

Functions

static int rb_len2int_inline (rb_len_t n)
 Checks if int can hold the given integer.
 

Detailed Description

Arithmetic conversion between rb_len_t 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 len_t.h.

Macro Definition Documentation

◆ rb_len2int

#define rb_len2int   rb_len2int_inline

Just another name of rb_len2int_inline.

Definition at line 32 of file len_t.h.

◆ RB_LEN2NUM

#define RB_LEN2NUM   RB_LONG2NUM

Converts a rb_len_t into an instance of rb_cInteger.

Definition at line 35 of file len_t.h.

◆ RB_NUM2LEN

#define RB_NUM2LEN   RB_NUM2LONG

Converts an instance of rb_cNumeric into rb_len_t.

Definition at line 38 of file len_t.h.

◆ RB_ULEN2NUM

#define RB_ULEN2NUM   RB_ULONG2NUM

Converts a rb_ulen_t into an instance of rb_cInteger.

Definition at line 41 of file len_t.h.

Function Documentation

◆ rb_len2int_inline()

static int rb_len2int_inline ( rb_len_t  n)
inlinestatic

Checks if int can hold the given integer.

Parameters
[in]nArbitrary rb_len_t value.
Exceptions
rb_eRangeError`n` is out of range of `int`.
Returns
Identical value of type int

Definition at line 51 of file len_t.h.