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
470da1ed
Commit
470da1ed
authored
May 17, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redefine POST/NEG FIXABLE using INT_MIN/MAX
parent
db20b4e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
include/mruby/numeric.h
include/mruby/numeric.h
+2
-4
src/object.c
src/object.c
+1
-2
No files found.
include/mruby/numeric.h
View file @
470da1ed
...
...
@@ -10,10 +10,8 @@
#include <limits.h>
#define RSHIFT(x,y) ((x)>>(int)(y))
#define FIXNUM_MAX (LONG_MAX>>1)
#define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
#define POSFIXABLE(f) ((f) < FIXNUM_MAX+1)
#define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
#define POSFIXABLE(f) ((f) <= INT_MAX)
#define NEGFIXABLE(f) ((f) >= INT_MIN)
#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
mrb_value
mrb_flt2big
(
mrb_state
*
mrb
,
mrb_float
d
);
...
...
src/object.c
View file @
470da1ed
...
...
@@ -565,8 +565,7 @@ mrb_convert_to_integer(mrb_state *mrb, mrb_value val, int base)
switch
(
mrb_type
(
val
))
{
case
MRB_TT_FLOAT
:
if
(
base
!=
0
)
goto
arg_error
;
if
(
mrb_float
(
val
)
<=
(
double
)
FIXNUM_MAX
&&
mrb_float
(
val
)
>=
(
double
)
FIXNUM_MIN
)
{
if
(
FIXABLE
(
mrb_float
(
val
)))
{
break
;
}
return
mrb_flt2big
(
mrb
,
mrb_float
(
val
));
...
...
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