From 20d79c9fb0cd2e72473f5fb08134cf72d0fdd9e7 Mon Sep 17 00:00:00 2001 From: ASVIEST <71895914+ASVIEST@users.noreply.github.com> Date: Tue, 2 Jan 2024 09:49:54 +0300 Subject: Deprecate asm stmt for js target (#23149) why ? - We already have an emit that does the same thing - The name asm itself is a bit confusing, you might think it's an alias for asm.js or something else. - The asm keyword is used differently on different compiler targets (it makes it inexpressive). - Does anyone (other than some compiler libraries) use asm instead of emit ? If yes, it's a bit strange to use asm somewhere and emit somewhere. By making the asm keyword for js target deprecated, there would be even less use of the asm keyword for js target, reducing the amount of confusion. - New users might accidentally use a non-universal approach via the asm keyword instead of emit, and then when they learn about asm, try to figure out what the differences are. see https://forum.nim-lang.org/t/10821 --------- Co-authored-by: Andreas Rumpf --- lib/pure/math.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/pure/math.nim') diff --git a/lib/pure/math.nim b/lib/pure/math.nim index 00f42ec1d..a90aef54c 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -219,13 +219,13 @@ when defined(js): let a = newFloat64Array(buffer) let b = newUint32Array(buffer) a[0] = x - asm """ + {.emit: """ function updateBit(num, bitPos, bitVal) { return (num & ~(1 << bitPos)) | (bitVal << bitPos); } `b`[1] = updateBit(`b`[1], 31, `sgn`); `result` = `a`[0] - """ + """.} proc signbit*(x: SomeFloat): bool {.inline, since: (1, 5, 1).} = ## Returns true if `x` is negative, false otherwise. -- cgit 1.4.1-2-gfad0