- 
                Notifications
    You must be signed in to change notification settings 
- Fork 23
Open
Labels
Description
Generally we want to have a precise type map between C and Rust. The problem we encountered is when we try to convert a positive number in C, we want to have a signed integer, i32 or i64, but we get a u32 directly.
Reference to the issue:rust-lang/rust-bindgen#1594
I'm not sure yet but will this be the part that generate the final result?
named!(c_int<i64>,
	map!(terminated!(alt_complete!(
		map_opt!(preceded!(tag!("0x"),many1!(complete!(hexadecimal))),|v|c_int_radix(v,16)) |
		map_opt!(preceded!(tag!("0b"),many1!(complete!(binary))),|v|c_int_radix(v,2)) |
		map_opt!(preceded!(char!('0'),many1!(complete!(octal))),|v|c_int_radix(v,8)) |
		map_opt!(many1!(complete!(decimal)),|v|c_int_radix(v,10)) |
		force_type!(IResult<_,_,u32>)
	),opt!(take_ul)),|i|i as i64)
);