util: Simplify SIMD setup#8579
util: Simplify SIMD setup#8579danyshaanan wants to merge 2 commits intonodejs:masterfrom danyshaanan:simd-setup-simplification
Conversation
|
|
||
| if (typeof SIMD.Uint32x4 === 'function') | ||
| simdFormatters.set(SIMD.Uint32x4, make(SIMD.Uint32x4.extractLane, 4)); | ||
| const countPerType = { |
There was a problem hiding this comment.
Would a Map be more useful here?
There was a problem hiding this comment.
I don't think it would. This object is just here to be iterated on two lines below
There was a problem hiding this comment.
A literal map, using the SIMD fields as keys?
There was a problem hiding this comment.
yeah as in new Map()
@targos simdFormatters is kind of the same case so consistency(?) :P
There was a problem hiding this comment.
Please just keep it as an Object.
lib/util.js
Outdated
|
|
||
| if (typeof SIMD.Uint8x16 === 'function') | ||
| simdFormatters.set(SIMD.Uint8x16, make(SIMD.Uint8x16.extractLane, 16)); | ||
| Object.keys(countPerType).forEach((key) => { |
There was a problem hiding this comment.
That can be simplified with a for..in loop
|
At @targos's suggestion, replaced I could squash the commits once the code will seem OK. |
|
Landed in 5f29947, thanks for the contribution @danyshaanan! |
PR-URL: #8579 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
PR-URL: #8579 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
|
Added the |
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesDescription of change
Turned the SIMD setup into a loop, and without the
typeofchecks, in accordance with nodejs/code-and-learn#56 (comment)