Coerce to signed 16-bit integer

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Bitwise
const toInt16 = (value) =>
  value << 16 >> 16

toInt16(0x8000)
ready
Typed array
const toInt16 = (value) =>
  new Int16Array([value])[0]

toInt16(0x8000)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.