Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
d8980020
Unverified
Commit
d8980020
authored
Feb 05, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a few new API for complex access.
parent
c6149370
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
mrbgems/mruby-complex/src/complex.c
mrbgems/mruby-complex/src/complex.c
+13
-2
No files found.
mrbgems/mruby-complex/src/complex.c
View file @
d8980020
...
...
@@ -67,8 +67,17 @@ complex_ptr(mrb_state *mrb, mrb_value v)
}
#endif
static
mrb_value
complex_new
(
mrb_state
*
mrb
,
mrb_float
real
,
mrb_float
imaginary
)
void
mrb_complex_get
(
mrb_state
*
mrb
,
mrb_value
cpx
,
mrb_float
*
r
,
mrb_float
*
i
)
{
struct
mrb_complex
*
c
=
complex_ptr
(
mrb
,
cpx
);
*
r
=
c
->
real
;
*
i
=
c
->
imaginary
;
}
mrb_value
mrb_complex_new
(
mrb_state
*
mrb
,
mrb_float
real
,
mrb_float
imaginary
)
{
struct
RClass
*
c
=
mrb_class_get_id
(
mrb
,
MRB_SYM
(
Complex
));
struct
mrb_complex
*
p
;
...
...
@@ -80,6 +89,8 @@ complex_new(mrb_state *mrb, mrb_float real, mrb_float imaginary)
return
mrb_obj_value
(
comp
);
}
#define complex_new(mrb, real, imag) mrb_complex_new(mrb, real, imag)
static
mrb_value
complex_real
(
mrb_state
*
mrb
,
mrb_value
self
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment