From 5fe8df548da507dd94e0ababc417340000729cdc Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 9 Mar 2017 05:13:44 +0000 Subject: [PATCH] Convert json.lua to native bitwise operators --- nselib/json.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nselib/json.lua b/nselib/json.lua index a0b473164..34a017fbd 100644 --- a/nselib/json.lua +++ b/nselib/json.lua @@ -20,7 +20,6 @@ -- Modified 02/27/2010 - v0.4 Added unicode handling (written by David Fifield). Renamed toJson -- and fromJson into generate() and parse(), implemented more proper numeric parsing and added some more error checking. -local bit = require "bit"; local nmap = require "nmap" local stdnse = require "stdnse" local string = require "string" @@ -98,7 +97,7 @@ local function unicode16 (subject, position, hex) error(("Bad unicode escape \\u%s\\u%s (bad low surrogate)"):format(hex, lowhex)) end position = position+6 -- consume '\uXXXX' - cp = 0x10000 + bit.band(cp, 0x3FF) * 0x400 + bit.band(cp2, 0x3FF) + cp = 0x10000 + (cp & 0x3FF) * 0x400 + (cp2 & 0x3FF) return position, unicode.utf8_enc(cp); end end