Ruby: internal/complex.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

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's object's, base components.
Definition rbasic.h:64
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