Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tornax O7
relibc
Commits
0b4b3cd5
Commit
0b4b3cd5
authored
5 years ago
by
Peter Limkilde Svendsen
Committed by
Jeremy Soller
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use lossless type conversion in ctype.h
parent
10f2e0fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/header/ctype/mod.rs
+25
-21
25 additions, 21 deletions
src/header/ctype/mod.rs
with
25 additions
and
21 deletions
src/header/ctype/mod.rs
+
25
−
21
View file @
0b4b3cd5
...
...
@@ -4,75 +4,79 @@ use crate::platform::types::*;
#[no_mangle]
pub
extern
"C"
fn
isalnum
(
c
:
c_int
)
->
c_int
{
(
isdigit
(
c
)
!=
0
||
isalpha
(
c
)
!=
0
)
as
c_int
c_int
::
from
(
isdigit
(
c
)
!=
0
||
isalpha
(
c
)
!=
0
)
}
#[no_mangle]
pub
extern
"C"
fn
isalpha
(
c
:
c_int
)
->
c_int
{
(
islower
(
c
)
!=
0
||
isupper
(
c
)
!=
0
)
as
c_int
c_int
::
from
(
islower
(
c
)
!=
0
||
isupper
(
c
)
!=
0
)
}
#[no_mangle]
pub
extern
"C"
fn
isascii
(
c
:
c_int
)
->
c_int
{
((
c
&
!
0x7f
)
==
0
)
as
c_int
c_int
::
from
((
c
&
!
0x7f
)
==
0
)
}
#[no_mangle]
pub
extern
"C"
fn
isblank
(
c
:
c_int
)
->
c_int
{
(
c
==
' '
as
c_int
||
c
==
'\t'
as
c_int
)
as
c_int
c_int
::
from
(
c
==
c_int
::
from
(
b' '
)
||
c
==
c_int
::
from
(
b'\t'
))
}
#[no_mangle]
pub
extern
"C"
fn
iscntrl
(
c
:
c_int
)
->
c_int
{
((
c
>=
0x00
&&
c
<=
0x1f
)
||
c
==
0x7f
)
as
c_int
c_int
::
from
((
c
>=
0x00
&&
c
<=
0x1f
)
||
c
==
0x7f
)
}
#[no_mangle]
pub
extern
"C"
fn
isdigit
(
c
:
c_int
)
->
c_int
{
(
c
>=
b'0'
as
c_int
&&
c
<=
b'9'
as
c_int
)
as
c_int
c_int
::
from
(
c
>=
c_int
::
from
(
b'0'
)
&&
c
<=
c_int
::
from
(
b'9'
))
}
#[no_mangle]
pub
extern
"C"
fn
isgraph
(
c
:
c_int
)
->
c_int
{
(
c
>=
0x21
&&
c
<=
0x7e
)
as
c_int
c_int
::
from
(
c
>=
0x21
&&
c
<=
0x7e
)
}
#[no_mangle]
pub
extern
"C"
fn
islower
(
c
:
c_int
)
->
c_int
{
(
c
>=
b'a'
as
c_int
&&
c
<=
b'z'
as
c_int
)
as
c_int
c_int
::
from
(
c
>=
c_int
::
from
(
b'a'
)
&&
c
<=
c_int
::
from
(
b'z'
))
}
#[no_mangle]
pub
extern
"C"
fn
isprint
(
c
:
c_int
)
->
c_int
{
(
c
>=
0x20
&&
c
<
0x7f
)
as
c_int
c_int
::
from
(
c
>=
0x20
&&
c
<
0x7f
)
}
#[no_mangle]
pub
extern
"C"
fn
ispunct
(
c
:
c_int
)
->
c_int
{
((
c
>=
b'!'
as
c_int
&&
c
<=
b'/'
as
c_int
)
||
(
c
>=
b':'
as
c_int
&&
c
<=
b'@'
as
c_int
)
||
(
c
>=
b'['
as
c_int
&&
c
<=
b'`'
as
c_int
)
||
(
c
>=
b'{'
as
c_int
&&
c
<=
b'~'
as
c_int
))
as
c_int
c_int
::
from
(
(
c
>=
c_int
::
from
(
b'!'
)
&&
c
<=
c_int
::
from
(
b'/'
))
||
(
c
>=
c_int
::
from
(
b':'
)
&&
c
<=
c_int
::
from
(
b'@'
))
||
(
c
>=
c_int
::
from
(
b'['
)
&&
c
<=
c_int
::
from
(
b'`'
))
||
(
c
>=
c_int
::
from
(
b'{'
)
&&
c
<=
c_int
::
from
(
b'~'
)),
)
}
#[no_mangle]
pub
extern
"C"
fn
isspace
(
c
:
c_int
)
->
c_int
{
(
c
==
' '
as
c_int
||
c
==
'\t'
as
c_int
||
c
==
'\n'
as
c_int
||
c
==
'\r'
as
c_int
||
c
==
0x0b
||
c
==
0x0c
)
as
c_int
c_int
::
from
(
c
==
c_int
::
from
(
b' '
)
||
c
==
c_int
::
from
(
b'\t'
)
||
c
==
c_int
::
from
(
b'\n'
)
||
c
==
c_int
::
from
(
b'\r'
)
||
c
==
0x0b
||
c
==
0x0c
,
)
}
#[no_mangle]
pub
extern
"C"
fn
isupper
(
c
:
c_int
)
->
c_int
{
(
c
>=
b'A'
as
c_int
&&
c
<=
b'Z'
as
c_int
)
as
c_int
c_int
::
from
(
c
>=
c_int
::
from
(
b'A'
)
&&
c
<=
c_int
::
from
(
b'Z'
))
}
#[no_mangle]
pub
extern
"C"
fn
isxdigit
(
c
:
c_int
)
->
c_int
{
(
isdigit
(
c
)
!=
0
||
(
c
|
32
>=
b'a'
as
c_int
&&
c
|
32
<=
'f'
as
c_int
))
as
c_int
c_int
::
from
(
isdigit
(
c
)
!=
0
||
(
c
|
32
>=
c_int
::
from
(
b'a'
)
&&
c
|
32
<=
c_int
::
from
(
b'f'
)))
}
#[no_mangle]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment