Skip to content

Commit 2eb03fd

Browse files
authored
Merge pull request ethereumjs#286 from ethereumjs/optim-byte
Optimise BYTE to only use bn.js
2 parents 9f2a7ed + ea1d772 commit 2eb03fd

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/opFns.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,7 @@ module.exports = {
156156
return new BN(0)
157157
}
158158

159-
pos = pos.toNumber()
160-
word = word.toArrayLike(Buffer, 'be', 32)
161-
word = utils.setLengthLeft(word, 32)
162-
163-
return new BN(word[pos])
159+
return word.shrn((31 - pos.toNumber()) * 8).andln(0xff)
164160
},
165161
// 0x20 range - crypto
166162
SHA3: function (offset, length, runState) {

0 commit comments

Comments
 (0)