TIL: Why ARM Has a JavaScript Instruction

ARM has this very specific instruction, FJCVTZS, doing "Floating-point Javascript Convert to Signed fixed-point, rounding toward Zero". For example, it converts Float64(42.99) to Int32(42). JavaScript uses double-precision floating-point (Float64) for all numbers (i.e., of type number). Yet many operations require 32-bit integers: bitwise operations, array indexing, typed array access. The language runtime must constantly convert Float64 to Int32 during normal execution flow of a typical JavaScript program.

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论