Ruby: internal/complex.h Source File

Ruby 3.4.8p72 (2025-12-17 revision 995b59f66677d44767ce9faac6957e5543617ff9)

complex.h
1#ifndef INTERNAL_COMPLEX_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_COMPLEX_H
11#include "ruby/internal/value.h" /* for struct RBasic */
12
13 struct RComplex {
14 struct RBasic basic;
15 VALUE real;
16 VALUE imag;
17};
18
19#define RCOMPLEX(obj) ((struct RComplex *)(obj))
20
21/* shortcut macro for internal only */
22#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->real, (r))
23#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->imag, (i))
24
25/* complex.c */
26 VALUE rb_dbl_complex_new_polar_pi(double abs, double ang);
27st_index_t rb_complex_hash(VALUE comp);
28
29#endif /* INTERNAL_COMPLEX_H */
RBasic
Ruby object's base components.
Definition rbasic.h:63
RComplex
Internal header for Complex.
Definition complex.h:13
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40