Enter your book access code

The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).

Don’t have the book yet? Get it on Amazon (US and other storefronts linked in the site footer) — the Preface access code unlocks this gym.

advanced · order 163

Integer luma without floats

wasm-luma-01Related book chapters: 25 (optional — this page is complete on its own)image

Slug: wasm-luma-01 · Paired reading: Chapter 25

Prompt

fn luma_rgb(r: u8, g: u8, b: u8) -> u8 using Rec.601: (r*299 + g*587 + b*114) / 1000.