|
|
|
|
|
by fpgaminer
3960 days ago
|
|
True, type inference would make an ideal solution difficult. But I'm totally fine with the compiler failing to apply implicit casting when type inference is involved. This code is just as readable, if not better: fn required_bytes(width: u16, height: u16) -> u64 {
let size: u64 = width * height;
size + 12
}
I just really don't want to have to write this all the time: fn required_bytes(width: u16, height: u16) -> u64 {
let size = (width as u64) * (height as u64);
size + 12
}
|
|