Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Issue 10870049: MIPS: Fix rounding in Uint8ClampedArray setter. (Closed)

Created:
8 years, 4 months ago by palfia
Modified:
8 years, 3 months ago
Reviewers:
kisg, Paul Lind, ulan, danno
CC:
v8-dev
Visibility:
Public.

Description

MIPS: Fix rounding in Uint8ClampedArray setter. Port r12364 (31e40def) Original commit message: According to Web IDL spec, we should round to the nearest integer, choosing the even integer if it lies halfway between two. BUG= TEST= Committed: https://code.google.com/p/v8/source/detail?r=12380

Patch Set 1 #

Total comments: 5

Patch Set 2 : Fix rounding of negative numbers in simulator. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -3 lines) Patch
M src/mips/macro-assembler-mips.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/mips/simulator-mips.cc View 1 1 chunk +7 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
palfia
8 years, 4 months ago (2012-08-23 23:07:13 UTC) #1
ulan
https://chromiumcodereview.appspot.com/10870049/diff/1/src/mips/simulator-mips.cc File src/mips/simulator-mips.cc (right): https://chromiumcodereview.appspot.com/10870049/diff/1/src/mips/simulator-mips.cc#newcode2073 src/mips/simulator-mips.cc:2073: double rounded = fs > 0 ? floor(fs + ...
8 years, 4 months ago (2012-08-24 07:21:07 UTC) #2
palfia
Thanks for your corrections, I've uploaded a new patchset, which fixes the rounding of negative ...
8 years, 4 months ago (2012-08-24 23:57:28 UTC) #3
ulan
8 years, 3 months ago (2012-08-27 07:23:26 UTC) #4
LGTM, I will land it.

https://chromiumcodereview.appspot.com/10870049/diff/1/src/mips/simulator-mip...
File src/mips/simulator-mips.cc (right):

https://chromiumcodereview.appspot.com/10870049/diff/1/src/mips/simulator-mip...
src/mips/simulator-mips.cc:2075: if ((result & 1) != 0 && result - fs == 0.5) {
On 2012/08/24 23:57:29, palfia wrote:
> On 2012/08/24 07:21:07, ulan wrote:
> > This doesn't handle the case when fs is negative, e.g. fs == -4.5, result ==
> -5,
> > result-fs == -0.5.
> 
> Using floor(fs + 0.5) above for negative numbers too, this expression becomes
> correct:
> e.g. fs = -4.5, result = -4 -> result-fs = 0.5
> or fs = 4.5, result = 5 -> result-fs = 0.5
> It'll be true for all other cases, because we always round half up in the
first
> step.

Yep, thanks for fixing it. :)

Powered by Google App Engine
This is Rietveld 408576698