Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(856)

Issue 4538053: code review 4538053: big: add Int methods to act on numbered bits. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 5 months ago by rog
Modified:
14 years, 2 months ago
Reviewers:
CC:
gri, rsc, golang-dev
Visibility:
Public.

Description

big: add Int methods to act on numbered bits. Speeds up setting individual bits by ~75%, useful when using big.Int as a bit set.

Patch Set 1 #

Patch Set 2 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Total comments: 25

Patch Set 7 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Total comments: 7

Patch Set 8 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Total comments: 11

Patch Set 9 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 11 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 12 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 13 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 14 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Patch Set 15 : diff -r 502384dd99e8 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -0 lines) Patch
M src/pkg/big/int.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +36 lines, -0 lines 0 comments Download
M src/pkg/big/int_test.go View 1 2 3 4 5 6 7 8 1 chunk +136 lines, -0 lines 0 comments Download
M src/pkg/big/nat.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +37 lines, -0 lines 0 comments Download

Messages

Total messages: 21
rog
Hello gri (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years, 5 months ago (2011-05-12 12:40:39 UTC) #1
rog
i wasn't sure whether to make the bit number a uint or an int. i ...
14 years, 5 months ago (2011-05-12 12:43:01 UTC) #2
gri
I'll have a look at the tests in a 2nd round. I am wondering if ...
14 years, 5 months ago (2011-05-12 18:54:49 UTC) #3
rog
oops. thanks for the review. will fix tomorrow. http://codereview.appspot.com/4538053/diff/11001/src/pkg/big/nat.go File src/pkg/big/nat.go (right): http://codereview.appspot.com/4538053/diff/11001/src/pkg/big/nat.go#newcode794 src/pkg/big/nat.go:794: i ...
14 years, 5 months ago (2011-05-12 19:35:30 UTC) #4
gri
On Thu, May 12, 2011 at 12:35 PM, <rogpeppe@gmail.com> wrote: > oops. thanks for the ...
14 years, 5 months ago (2011-05-12 19:41:48 UTC) #5
rog
PTAL > I am wondering if it would make sense to return the i'th bit ...
14 years, 4 months ago (2011-05-16 12:01:49 UTC) #6
rsc
http://codereview.appspot.com/4538053/diff/6/src/pkg/big/int.go File src/pkg/big/int.go (right): http://codereview.appspot.com/4538053/diff/6/src/pkg/big/int.go#newcode564 src/pkg/big/int.go:564: func (z *Int) Bit(i int) bool { seems like ...
14 years, 4 months ago (2011-05-16 12:48:20 UTC) #7
rog
On 16 May 2011 13:48, <rsc@golang.org> wrote: > > http://codereview.appspot.com/4538053/diff/6/src/pkg/big/int.go > File src/pkg/big/int.go (right): > ...
14 years, 4 months ago (2011-05-16 13:17:51 UTC) #8
rog
http://codereview.appspot.com/4538053/diff/6/src/pkg/big/int.go File src/pkg/big/int.go (right): http://codereview.appspot.com/4538053/diff/6/src/pkg/big/int.go#newcode577 src/pkg/big/int.go:577: // That is, if bit is true SetBit sets ...
14 years, 4 months ago (2011-05-16 13:19:57 UTC) #9
gri
http://codereview.appspot.com/4538053/diff/10004/src/pkg/big/int.go File src/pkg/big/int.go (right): http://codereview.appspot.com/4538053/diff/10004/src/pkg/big/int.go#newcode564 src/pkg/big/int.go:564: func (z *Int) Bit(i int) bool { We had ...
14 years, 4 months ago (2011-05-16 17:46:36 UTC) #10
rog
On 16 May 2011 18:46, <gri@golang.org> wrote: > > http://codereview.appspot.com/4538053/diff/10004/src/pkg/big/int.go > File src/pkg/big/int.go (right): > ...
14 years, 4 months ago (2011-05-16 17:59:47 UTC) #11
gri
I think it should be uint; there's no added benefit of making it a byte. ...
14 years, 4 months ago (2011-05-16 18:10:11 UTC) #12
rog
PTAL http://codereview.appspot.com/4538053/diff/10004/src/pkg/big/nat.go File src/pkg/big/nat.go (right): http://codereview.appspot.com/4538053/diff/10004/src/pkg/big/nat.go#newcode776 src/pkg/big/nat.go:776: func (z nat) setBit(x nat, b uint, bit ...
14 years, 4 months ago (2011-05-16 19:03:26 UTC) #13
gri
It's close. http://codereview.appspot.com/4538053/diff/17001/src/pkg/big/nat.go File src/pkg/big/nat.go (right): http://codereview.appspot.com/4538053/diff/17001/src/pkg/big/nat.go#newcode776 src/pkg/big/nat.go:776: func (z nat) setBit(x nat, i int, ...
14 years, 4 months ago (2011-05-16 20:27:23 UTC) #14
rog
I had a uint index originally for this reason, and I changed it to int ...
14 years, 4 months ago (2011-05-16 21:02:14 UTC) #15
rog
Hello gri, rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 4 months ago (2011-05-17 06:47:39 UTC) #16
rsc
LGTM Leaving for gri.
14 years, 4 months ago (2011-05-17 14:35:44 UTC) #17
gri
It looks like it's unchanged. But when I look at patch set 13 your changes ...
14 years, 4 months ago (2011-05-17 15:55:45 UTC) #18
rog
I'm fairly sure I didn't change it back, and the usual "View" link seems to ...
14 years, 4 months ago (2011-05-17 17:12:50 UTC) #19
gri
LGTM I got it. I was expecting that you were also switching the Int.Bit/SetBit index ...
14 years, 4 months ago (2011-05-17 20:37:12 UTC) #20
gri
14 years, 4 months ago (2011-05-17 20:38:25 UTC) #21
*** Submitted as http://code.google.com/p/go/source/detail?r=0eeb0f5fa186 ***

big: add Int methods to act on numbered bits.
Speeds up setting individual bits by ~75%, useful
when using big.Int as a bit set.

R=gri, rsc
CC=golang-dev
http://codereview.appspot.com/4538053

Committer: Robert Griesemer <gri@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b