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
f3191b94
Commit
f3191b94
authored
Nov 16, 2012
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #555 from masuidrive/define_mrb_int_as_64bit
define MRB_INT64 flag for mrb_int as 64bit
parents
ac0233bc
7a20ab0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
16 deletions
+31
-16
include/mrbconf.h
include/mrbconf.h
+31
-16
No files found.
include/mrbconf.h
View file @
f3191b94
...
...
@@ -13,6 +13,9 @@
/* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */
//#define MRB_USE_FLOAT
/* add -DMRB_INT64 to use 64bit integer for mrb_int */
//#define MRB_INT64
/* represent mrb_value in boxed double; conflict with MRB_USE_FLOAT */
//#define MRB_NAN_BOXING
...
...
@@ -54,27 +57,39 @@
/* end of configuration */
#ifdef MRB_USE_FLOAT
typedef
float
mrb_float
;
#define mrb_float_to_str(buf, i) sprintf((buf), "%.7e", (i))
#define str_to_mrb_float(buf) (mrb_float)strtof((buf),NULL)
typedef
float
mrb_float
;
#
define mrb_float_to_str(buf, i) sprintf((buf), "%.7e", (i))
#
define str_to_mrb_float(buf) (mrb_float)strtof((buf),NULL)
#else
typedef
double
mrb_float
;
#define mrb_float_to_str(buf, i) sprintf((buf), "%.16e", (i))
#define str_to_mrb_float(buf) (mrb_float)strtod((buf),NULL)
typedef
double
mrb_float
;
#
define mrb_float_to_str(buf, i) sprintf((buf), "%.16e", (i))
#
define str_to_mrb_float(buf) (mrb_float)strtod((buf),NULL)
#endif
#ifdef MRB_NAN_BOXING
typedef
int32_t
mrb_int
;
#define MRB_INT_MIN INT32_MIN
#define MRB_INT_MAX INT32_MAX
#define mrb_int_to_str(buf, i) sprintf((buf), "%d", (i))
#define str_to_mrb_int(buf) (mrb_int)strtol((buf), NULL, 10);
# ifdef MRB_INT64
# error Cannot use NaN boxing when mrb_int is 64bit
# else
typedef
int32_t
mrb_int
;
# define MRB_INT_MIN INT32_MIN
# define MRB_INT_MAX INT32_MAX
# define mrb_int_to_str(buf, i) sprintf((buf), "%d", (i))
# define str_to_mrb_int(buf) (mrb_int)strtol((buf), NULL, 10)
# endif
#else
typedef
int
mrb_int
;
#define MRB_INT_MIN INT_MIN
#define MRB_INT_MAX INT_MAX
#define mrb_int_to_str(buf, i) sprintf((buf), "%d", (i))
#define str_to_mrb_int(buf) (mrb_int)strtol((buf), NULL, 10);
# ifdef MRB_INT64
typedef
int64_t
mrb_int
;
# define MRB_INT_MIN INT64_MIN
# define MRB_INT_MAX INT64_MAX
# define mrb_int_to_str(buf, i) sprintf((buf), "%ld", (i))
# define str_to_mrb_int(buf) (mrb_int)strtoll((buf), NULL, 10)
# else
typedef
int
mrb_int
;
# define MRB_INT_MIN INT_MIN
# define MRB_INT_MAX INT_MAX
# define mrb_int_to_str(buf, i) sprintf((buf), "%d", (i))
# define str_to_mrb_int(buf) (mrb_int)strtol((buf), NULL, 10)
# endif
#endif
typedef
short
mrb_sym
;
...
...
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