simpler portable round()
Calling out lrintf() is probably kind of extreme... adding half and truncating should be just fine. Change-Id: Ifb22c1c1a9b764be153b769aad4671ca44311255 Reviewed-on: https://skia-review.googlesource.com/17708 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
b8abb4c636
commit
e980174d0f
@ -35,7 +35,7 @@
|
||||
SI F rcp (F v) { return 1.0f / v; }
|
||||
SI F rsqrt (F v) { return 1.0f / sqrtf(v); }
|
||||
SI F sqrt_(F v) { return sqrtf(v); }
|
||||
SI U32 round (F v, F scale) { return (uint32_t)lrintf(v*scale); }
|
||||
SI U32 round (F v, F scale) { return (uint32_t)(v*scale + 0.5f); }
|
||||
SI U16 pack(U32 v) { return (U16)v; }
|
||||
SI U8 pack(U16 v) { return (U8)v; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user