Skip to main content

mul255

Function mul255 

Source
pub fn mul255(a: u8, b: u8) -> u8
Expand description

a * b / 255, truncating — the oracle’s ubiquitous 8-bit product.

use pdfrum_render::pixmap::mul255;

assert_eq!(mul255(255, 128), 128);
// Truncating: 128 * 128 / 255 is 64, not 64.25 rounded.
assert_eq!(mul255(128, 128), 64);