-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update bitlen to use __clzdi2 when using gccgo
- Loading branch information
Showing
10 changed files
with
37 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// +build gccgo !amd64,!386,!arm | ||
// +build !gccgo,!amd64,!386,!arm | ||
|
||
// (gccgo) OR ((NOT amd64) AND (NOT 386) AND (NOT ARM)) | ||
package encoding | ||
|
||
import ( | ||
"math/big" | ||
"math/big" | ||
) | ||
|
||
func bitlen(x big.Word) (n int) { | ||
return 32 - int(nlz1a(uint32(x))) | ||
return 32 - int(nlz1a(uint32(x))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// +build !gccgo | ||
// +build amd64 386 arm | ||
|
||
package encoding | ||
|
||
import ( | ||
"math/big" | ||
) | ||
|
||
// This is defined in util_{amd64,386}.s, copied from pkg/math/big/arith_{amd64/386}.s | ||
func bitlen(x big.Word) (n int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// +build gccgo | ||
|
||
package encoding | ||
|
||
import ( | ||
"math/big" | ||
) | ||
|
||
func clz(uint64) uint64 __asm__("__clzdi2") | ||
|
||
func bitlen(x big.Word) (n int) { | ||
if x == 0 { return 0 } | ||
return 64-int(clz(uint64(x))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ package fastpfor | |
|
||
import ( | ||
"errors" | ||
"github.com/reducedb/bytebuffer" | ||
"github.com/reducedb/encoding" | ||
"github.com/reducedb/encoding/bitpacking" | ||
"github.com/reducedb/bytebuffer" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zhenjl
Author
Collaborator
|
||
"github.com/reducedb/encoding/cursor" | ||
"math" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry for commenting on a commit so lately, but it's always a bit nicer if formatting changes are separate from functional changes. I'm quite interested in how you did this (I love Go and I love performance, what can I say), so the formatting changes and reorderings are a bit distracting. I don't always follow my own advice so well, but I try to :).
Very nice blog post as well! Kudos on the great benchmarking and implementation.