]> Cypherpunks repositories - gostls13.git/commit
cmd/asm: fix shifts again, this time for sure
authorRob Pike <r@golang.org>
Mon, 22 Jun 2015 22:40:40 +0000 (08:40 +1000)
committerRob Pike <r@golang.org>
Tue, 23 Jun 2015 06:44:54 +0000 (06:44 +0000)
commit989b372a5cb73c982aa5ba00081e67e89cc71ff1
tree4bbb29f3458914f07ff997b3af9ae5e3d145da7c
parent4bba6729f85a3f99fcb05d8e5cc2e180bc9d4a90
cmd/asm: fix shifts again, this time for sure

There are two conditions to worry about:

1) The shift count cannot be negative. Since the evaluator uses unsigned
arithmetic throughout, this means checking that the high bit of
the shift count is always off, which is done by converting to int64
and seeing if the result is negative.

2) For right shifts, the value cannot be negative. We don't want a
high bit in the value because right shifting a value depends on the
sign, and for clarity we always want unsigned shifts.

Next step is to build some testing infrastructure for the parser.

Change-Id: I4c46c79989d02c107fc64954403fc18613763f1d
Reviewed-on: https://go-review.googlesource.com/11326
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/asm/internal/asm/parse.go