Search
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (427 Bytes)
Feature #10594
» num_clamp.c
0x0dea (D.E. Akers)
, 06/30/2015 02:18 AM
static
VALUE
num_clamp
(
VALUE
num
,
VALUE
obj
)
{
VALUE
begp
,
endp
;
int
exclp
;
if
(
!
rb_range_values
(
obj
,
&
begp
,
&
endp
,
&
exclp
))
{
rb_raise
(
rb_eArgError
,
"argument must be a Range"
);
}
if
(
exclp
)
endp
=
rb_funcall
(
endp
,
rb_intern
(
"pred"
),
0
);
if
(
rb_funcall
(
num
,
idLT
,
1
,
begp
))
{
return
begp
;
}
else
if
(
rb_funcall
(
num
,
idGT
,
1
,
endp
))
{
return
endp
;
}
return
num
;
}
« Previous
1
2
Next »
(1-1/2)
Loading...