Skip to content

Commit 46af415

Browse files
authored
Update fastexponent.go
1 parent 21381ac commit 46af415

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

math/power/fastexponent.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ package power
44
func IterativePower(n uint, power uint) uint {
55
var res uint = 1
66
for power > 0 {
7-
87
if (power & 1) != 0 {
98
res = res * n
109
}
1110

1211
power = power >> 1
13-
n = n * n
12+
n *= n
1413
}
1514
return res
1615
}

0 commit comments

Comments
 (0)