Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
f200c30d
Commit
f200c30d
authored
Apr 17, 2014
by
Paul Sokolovsky
Browse files
modffi: Support float types.
parent
8865b22b
Changes
1
Hide whitespace changes
Inline
Side-by-side
unix/modffi.c
View file @
f200c30d
...
...
@@ -61,6 +61,8 @@ STATIC ffi_type *char2ffi_type(char c)
case
'I'
:
return
&
ffi_type_uint
;
case
'l'
:
return
&
ffi_type_slong
;
case
'L'
:
return
&
ffi_type_ulong
;
case
'f'
:
return
&
ffi_type_float
;
case
'd'
:
return
&
ffi_type_double
;
case
'p'
:
case
's'
:
return
&
ffi_type_pointer
;
case
'v'
:
return
&
ffi_type_void
;
...
...
@@ -92,6 +94,14 @@ STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
}
case
'v'
:
return
mp_const_none
;
case
'f'
:
{
float
*
p
=
(
float
*
)
&
val
;
return
mp_obj_new_float
(
*
p
);
}
case
'd'
:
{
double
*
p
=
(
double
*
)
&
val
;
return
mp_obj_new_float
(
*
p
);
}
default:
return
mp_obj_new_int
(
val
);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment