Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/premultiplied-argb/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ for (int64_t i = 0; i < w * h; i++) {
uint8_t r = 255 * ((pixel >> 16) & 0xff) / a;
uint8_t g = 255 * ((pixel >> 8) & 0xff) / a;
uint8_t b = 255 * (pixel & 0xff) / a;
out[i] = GUINT32_TO_BE(r << 24 | g << 16 | b << 8);
// uint32_t cast avoids undefined behavior: left shift into sign bit
// after r is promoted to int.
out[i] = GUINT32_TO_BE((uint32_t) r << 24 | g << 16 | b << 8);
}
}
```
Expand Down