lshift
Definition
-- @/=[C]:-1
function lshift(...)
Callers
@/lua/common/libs/luamqtt/mqtt/protocol5.lua
if args.clean then
byte = bor(byte, lshift(1, 1))
end
-- will flag should be set to 1
byte = bor(byte, lshift(1, 2))
-- DOC: 3.1.2.6 Will QoS
-- DOC: 3.1.2.6 Will QoS
byte = bor(byte, lshift(args.will.qos, 3))
-- DOC: 3.1.2.7 Will Retain
if args.will.retain then
byte = bor(byte, lshift(1, 5))
end
assert(type(args.username) == "string", "expecting .username to be a string")
byte = bor(byte, lshift(1, 7))
end
assert(args.username, "the .username is required to set .password")
byte = bor(byte, lshift(1, 6))
end
-- DOC: 3.3.1.2 QoS
flags = bor(flags, lshift(args.qos or 0, 1))
-- DOC: 3.3.1.1 DUP
if args.dup then
flags = bor(flags, lshift(1, 3))
end
if subscription.retain_handling then
so = bor(so, lshift(subscription.retain_handling, 4)) -- set Bit 4 and 5
end
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaShifter.lua
if band(crc, 0x80) ~= 0 then
crc = lshift(crc, 1)
crc = bxor(crc, 0x1D)
else
crc = lshift(crc, 1)
end
@/lua/ge/extensions/editor/inspector.lua
if valTbl1[i] ~= valTbl2[i] then
flags = bit.bor(flags, bit.lshift(1, i - 1))
end
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaKombi.lua
if band(crc, 0x80) ~= 0 then
crc = lshift(crc, 1)
crc = bxor(crc, 0x1D)
else
crc = lshift(crc, 1)
end
local function sendCountedAndCheckSummedMessage4Bit(messageInfo, counterHighBits, data, dt)
sendCountedAndCheckSummedMessage4BitShifted(messageInfo, lshift(counterHighBits, 4), data, dt)
end
end
local payload = {firstByte, (counter + lshift(counterHighBits, 4))}
for _, dataByte in pairs(data) do
local rpm = electrics.values.rpm
local rpm1, rpm2 = canBus.twoBytes(lshift(band(rpm * 0.1, 0xFFF), 4)) --12bits for RPM, shifted 4 to the left to make room for the counter in the remaining 4 bits
sendCountedAndCheckSummedMessage4BitShifted(messageInfos.engineSpeed, rpm1, {rpm2, 0xC0, 0xF0, 0xC4, 0xFF, 0xFF}, dt)
--TODO year not working
sendMessage(messageInfos.setTimeDate, {timeDate.hour, timeDate.min, timeDate.sec, timeDate.day, lshift(timeDate.month, 4) + 0xF, year1, year2, 0xF2}, dt) --works! gets rid of one yellow warning
@/lua/ge/extensions/editor/api/dynamicDecals.lua
None = {name = "None", value = 0},
UseMousePos = {name = "Use Mouse Pos", value = bit.lshift(1,2), description = "Sets the cursor position for the decal projection either at the mouse cursor position or at the center of the screen."},
UseGradientColor = {name = "Use Gradient Color", value = bit.lshift(1,3)},
UseMousePos = {name = "Use Mouse Pos", value = bit.lshift(1,2), description = "Sets the cursor position for the decal projection either at the mouse cursor position or at the center of the screen."},
UseGradientColor = {name = "Use Gradient Color", value = bit.lshift(1,3)},
AlphaMaskInvert = {name = "Invert Alpha Mask", value = bit.lshift(1,4)},
UseGradientColor = {name = "Use Gradient Color", value = bit.lshift(1,3)},
AlphaMaskInvert = {name = "Invert Alpha Mask", value = bit.lshift(1,4)},
WrapAlphaMaskX = {name = "Wrap Alpha Mask Horizontally", value = bit.lshift(1,5)},
AlphaMaskInvert = {name = "Invert Alpha Mask", value = bit.lshift(1,4)},
WrapAlphaMaskX = {name = "Wrap Alpha Mask Horizontally", value = bit.lshift(1,5)},
WrapAlphaMaskY = {name = "Wrap Alpha Mask Vertically", value = bit.lshift(1,6)},
WrapAlphaMaskX = {name = "Wrap Alpha Mask Horizontally", value = bit.lshift(1,5)},
WrapAlphaMaskY = {name = "Wrap Alpha Mask Vertically", value = bit.lshift(1,6)},
WrapColorTextureX = {name = "Wrap Color Texture Horizontally", value = bit.lshift(1,7)},
WrapAlphaMaskY = {name = "Wrap Alpha Mask Vertically", value = bit.lshift(1,6)},
WrapColorTextureX = {name = "Wrap Color Texture Horizontally", value = bit.lshift(1,7)},
WrapColorTextureY = {name = "Wrap Color Texture Vertically", value = bit.lshift(1,8)}
WrapColorTextureX = {name = "Wrap Color Texture Horizontally", value = bit.lshift(1,7)},
WrapColorTextureY = {name = "Wrap Color Texture Vertically", value = bit.lshift(1,8)}
}
Ok = 0,
Warning = bit.lshift(1,0),
Error = bit.lshift(1,1),
Warning = bit.lshift(1,0),
Error = bit.lshift(1,1),
LayerStackDataTypeIncorrect = bit.lshift(1,2),
Error = bit.lshift(1,1),
LayerStackDataTypeIncorrect = bit.lshift(1,2),
LayerDataTypeIncorrect = bit.lshift(1,3),
LayerStackDataTypeIncorrect = bit.lshift(1,2),
LayerDataTypeIncorrect = bit.lshift(1,3),
TextureFileMissing = bit.lshift(1,4),
LayerDataTypeIncorrect = bit.lshift(1,3),
TextureFileMissing = bit.lshift(1,4),
FontFileMissing = bit.lshift(1,5),
TextureFileMissing = bit.lshift(1,4),
FontFileMissing = bit.lshift(1,5),
}
@/lua/vehicle/extensions/tech/CANBus/CANBusPeak.lua
local function combineTwoBytes(b1, b2)
return bor(lshift(b1, 8), b2)
end
@/lua/vehicle/extensions/tech/LINBus/LINBusPeak.lua
local function combineTwoBytes(b1, b2)
return bor(lshift(b1, 8), b2)
end
@/lua/ge/extensions/editor/visualization.lua
local function to8(x) return math.floor((x or 0) * 255 + 0.5) end
return bit.bor(bit.lshift(to8(a or 1), 24), bit.lshift(to8(b), 16), bit.lshift(to8(g), 8), to8(r))
end
local function to8(x) return math.floor((x or 0) * 255 + 0.5) end
return bit.bor(bit.lshift(to8(a or 1), 24), bit.lshift(to8(b), 16), bit.lshift(to8(g), 8), to8(r))
end
local function to8(x) return math.floor((x or 0) * 255 + 0.5) end
return bit.bor(bit.lshift(to8(a or 1), 24), bit.lshift(to8(b), 16), bit.lshift(to8(g), 8), to8(r))
end
FlagsDebugNone = 0,
FlagsDebugBaseColor = bit.lshift(1,0),
FlagsDebugOpacity = bit.lshift(1,1),
FlagsDebugBaseColor = bit.lshift(1,0),
FlagsDebugOpacity = bit.lshift(1,1),
FlagsDebugMetallic = bit.lshift(1,2),
FlagsDebugOpacity = bit.lshift(1,1),
FlagsDebugMetallic = bit.lshift(1,2),
FlagsDebugRoughness = bit.lshift(1,3),
FlagsDebugMetallic = bit.lshift(1,2),
FlagsDebugRoughness = bit.lshift(1,3),
FlagsDebugAmbientOcclusion = bit.lshift(1,4),
FlagsDebugRoughness = bit.lshift(1,3),
FlagsDebugAmbientOcclusion = bit.lshift(1,4),
FlagsDebugClearCoat = bit.lshift(1,5),
FlagsDebugAmbientOcclusion = bit.lshift(1,4),
FlagsDebugClearCoat = bit.lshift(1,5),
FlagsDebugClearCoatRoughness = bit.lshift(1,6),
FlagsDebugClearCoat = bit.lshift(1,5),
FlagsDebugClearCoatRoughness = bit.lshift(1,6),
FlagsDebugUV0 = bit.lshift(1,7),
FlagsDebugClearCoatRoughness = bit.lshift(1,6),
FlagsDebugUV0 = bit.lshift(1,7),
FlagsDebugUV0Checkerboard = bit.lshift(1,8),
FlagsDebugUV0 = bit.lshift(1,7),
FlagsDebugUV0Checkerboard = bit.lshift(1,8),
FlagsDebugUV0ColorGrid = bit.lshift(1,9),
FlagsDebugUV0Checkerboard = bit.lshift(1,8),
FlagsDebugUV0ColorGrid = bit.lshift(1,9),
FlagsDebugUV1 = bit.lshift(1,10),
FlagsDebugUV0ColorGrid = bit.lshift(1,9),
FlagsDebugUV1 = bit.lshift(1,10),
FlagsDebugUV1Checkerboard = bit.lshift(1,11),
FlagsDebugUV1 = bit.lshift(1,10),
FlagsDebugUV1Checkerboard = bit.lshift(1,11),
FlagsDebugUV1ColorGrid = bit.lshift(1,12),
FlagsDebugUV1Checkerboard = bit.lshift(1,11),
FlagsDebugUV1ColorGrid = bit.lshift(1,12),
FlagsDebugMaterialDeprecated = bit.lshift(1,13),
FlagsDebugUV1ColorGrid = bit.lshift(1,12),
FlagsDebugMaterialDeprecated = bit.lshift(1,13),
FlagsDebugLayerCount = bit.lshift(1,14),
FlagsDebugMaterialDeprecated = bit.lshift(1,13),
FlagsDebugLayerCount = bit.lshift(1,14),
FlagsDebugNormalsWS = bit.lshift(1,15),
FlagsDebugLayerCount = bit.lshift(1,14),
FlagsDebugNormalsWS = bit.lshift(1,15),
FlagsDebugEmissive = bit.lshift(1,16),
FlagsDebugNormalsWS = bit.lshift(1,15),
FlagsDebugEmissive = bit.lshift(1,16),
FlagsDebugTriangleSize = bit.lshift(1,17),
FlagsDebugEmissive = bit.lshift(1,16),
FlagsDebugTriangleSize = bit.lshift(1,17),
FlagsDebugMipBaseColor = bit.lshift(1,18),
FlagsDebugTriangleSize = bit.lshift(1,17),
FlagsDebugMipBaseColor = bit.lshift(1,18),
}
@/lua/common/libs/luamqtt/mqtt/protocol.lua
local byte1, byte2 = str_byte(len, 1, 2)
len = bor(lshift(byte1, 8), byte2)
-- and return string if parsed length
local byte1, byte2 = str_byte(value, 1, 2)
return lshift(byte1, 8) + byte2
end
if _VERSION < "Lua 5.3" then
return byte1 * (2 ^ 24) + lshift(byte2, 16) + lshift(byte3, 8) + byte4
else
if _VERSION < "Lua 5.3" then
return byte1 * (2 ^ 24) + lshift(byte2, 16) + lshift(byte3, 8) + byte4
else
else
return lshift(byte1, 24) + lshift(byte2, 16) + lshift(byte3, 8) + byte4
end
else
return lshift(byte1, 24) + lshift(byte2, 16) + lshift(byte3, 8) + byte4
end
else
return lshift(byte1, 24) + lshift(byte2, 16) + lshift(byte3, 8) + byte4
end
function protocol.make_header(ptype, flags, len)
local byte1 = bor(lshift(ptype, 4), band(flags, 0x0F))
return str_char(byte1, make_var_length(len))
@/lua/ge/extensions/editor/sceneTree.lua
local searchNodeMode = SearchMode_All
local searchMatches = { bit.lshift(1, 0), bit.lshift(1, 1), bit.lshift(1, 2), bit.lshift(1, 3), bit.lshift(1, 4)} -- displayname, name, id, persistentId, class
local searchNodeMode = SearchMode_All
local searchMatches = { bit.lshift(1, 0), bit.lshift(1, 1), bit.lshift(1, 2), bit.lshift(1, 3), bit.lshift(1, 4)} -- displayname, name, id, persistentId, class
local searchNodeMode = SearchMode_All
local searchMatches = { bit.lshift(1, 0), bit.lshift(1, 1), bit.lshift(1, 2), bit.lshift(1, 3), bit.lshift(1, 4)} -- displayname, name, id, persistentId, class
local searchNodeMode = SearchMode_All
local searchMatches = { bit.lshift(1, 0), bit.lshift(1, 1), bit.lshift(1, 2), bit.lshift(1, 3), bit.lshift(1, 4)} -- displayname, name, id, persistentId, class
local searchNodeMode = SearchMode_All
local searchMatches = { bit.lshift(1, 0), bit.lshift(1, 1), bit.lshift(1, 2), bit.lshift(1, 3), bit.lshift(1, 4)} -- displayname, name, id, persistentId, class
@/lua/ge/extensions/editor/api/gui.lua
local InputFloat_IndeterminateX = bit.lshift(1,0)
local InputFloat_IndeterminateY = bit.lshift(1,1)
local InputFloat_IndeterminateX = bit.lshift(1,0)
local InputFloat_IndeterminateY = bit.lshift(1,1)
local InputFloat_IndeterminateZ = bit.lshift(1,2)
local InputFloat_IndeterminateY = bit.lshift(1,1)
local InputFloat_IndeterminateZ = bit.lshift(1,2)
local InputFloat_IndeterminateW = bit.lshift(1,3)
local InputFloat_IndeterminateZ = bit.lshift(1,2)
local InputFloat_IndeterminateW = bit.lshift(1,3)
@/lua/common/libs/lua-websockets/websocket/tools.lua
local new_pos,a,b = read_n_bytes(str, pos, 2)
return new_pos, lshift(a, 8) + b
end
return new_pos,
lshift(a, 24) +
lshift(b, 16) +
lshift(a, 24) +
lshift(b, 16) +
lshift(c, 8 ) +
lshift(b, 16) +
lshift(c, 8 ) +
d
@/lua/common/libs/luamqtt/mqtt/protocol4.lua
if args.clean then
byte = bor(byte, lshift(1, 1))
end
-- will flag should be set to 1
byte = bor(byte, lshift(1, 2))
-- DOC: 3.1.2.6 Will QoS
-- DOC: 3.1.2.6 Will QoS
byte = bor(byte, lshift(args.will.qos or 0, 3))
-- DOC: 3.1.2.7 Will Retain
if args.will.retain then
byte = bor(byte, lshift(1, 5))
end
assert(type(args.username) == "string", "expecting .username to be a string")
byte = bor(byte, lshift(1, 7))
end
assert(args.username, "the .username is required to set .password")
byte = bor(byte, lshift(1, 6))
end
-- DOC: 3.3.1.2 QoS
flags = bor(flags, lshift(args.qos or 0, 1))
-- DOC: 3.3.1.1 DUP
if args.dup then
flags = bor(flags, lshift(1, 3))
end