Add 64-bit integer type
Because the integer data in json is very large, and we need to store such data in slint. Of course, using string storage is also a compromise, but such an implementation is not very convenient for directly operating integer numbers.
True.
We could make int to be 64 bits.
Or we could add a int64 or i64 type.
I’d rather go for adding a new int64 type, since the extra memory overhead might not be acceptable for everyone.
For about a year and a half, I’ve been using a workaround where I combine two int values to create a u64, that I use in rust side
pub(crate) fn split_u64_into_i32s(value: u64) -> (i32, i32) {
let part1: i32 = (value >> 32) as i32;
let part2: i32 = value as i32;
(part1, part2)
}
pub(crate) fn connect_i32_into_u64(part1: i32, part2: i32) -> u64 {
((part1 as u64) << 32) | (part2 as u64 & 0xFFFF_FFFF)
}
This makes operations on models a bit more cumbersome, so I’m also looking forward to having a new type added.