band
Definition
-- @/=[C]:-1
function band(...)
Callers
@/lua/ge/extensions/ui/bindingsLegend.lua
local modifierNames = {}
if bit.band(newModifiers, MODIFIER_L_SHIFT) == MODIFIER_L_SHIFT or bit.band(newModifiers, MODIFIER_R_SHIFT) == MODIFIER_R_SHIFT then table.insert(modifierNames, "shift") end
if bit.band(newModifiers, MODIFIER_L_CTRL) == MODIFIER_L_CTRL or bit.band(newModifiers, MODIFIER_R_CTRL) == MODIFIER_R_CTRL then table.insert(modifierNames, "ctrl") end
local modifierNames = {}
if bit.band(newModifiers, MODIFIER_L_SHIFT) == MODIFIER_L_SHIFT or bit.band(newModifiers, MODIFIER_R_SHIFT) == MODIFIER_R_SHIFT then table.insert(modifierNames, "shift") end
if bit.band(newModifiers, MODIFIER_L_CTRL) == MODIFIER_L_CTRL or bit.band(newModifiers, MODIFIER_R_CTRL) == MODIFIER_R_CTRL then table.insert(modifierNames, "ctrl") end
if bit.band(newModifiers, MODIFIER_L_SHIFT) == MODIFIER_L_SHIFT or bit.band(newModifiers, MODIFIER_R_SHIFT) == MODIFIER_R_SHIFT then table.insert(modifierNames, "shift") end
if bit.band(newModifiers, MODIFIER_L_CTRL) == MODIFIER_L_CTRL or bit.band(newModifiers, MODIFIER_R_CTRL) == MODIFIER_R_CTRL then table.insert(modifierNames, "ctrl") end
if bit.band(newModifiers, MODIFIER_L_ALT) == MODIFIER_L_ALT or bit.band(newModifiers, MODIFIER_R_ALT) == MODIFIER_R_ALT then table.insert(modifierNames, "alt") end
if bit.band(newModifiers, MODIFIER_L_SHIFT) == MODIFIER_L_SHIFT or bit.band(newModifiers, MODIFIER_R_SHIFT) == MODIFIER_R_SHIFT then table.insert(modifierNames, "shift") end
if bit.band(newModifiers, MODIFIER_L_CTRL) == MODIFIER_L_CTRL or bit.band(newModifiers, MODIFIER_R_CTRL) == MODIFIER_R_CTRL then table.insert(modifierNames, "ctrl") end
if bit.band(newModifiers, MODIFIER_L_ALT) == MODIFIER_L_ALT or bit.band(newModifiers, MODIFIER_R_ALT) == MODIFIER_R_ALT then table.insert(modifierNames, "alt") end
if bit.band(newModifiers, MODIFIER_L_CTRL) == MODIFIER_L_CTRL or bit.band(newModifiers, MODIFIER_R_CTRL) == MODIFIER_R_CTRL then table.insert(modifierNames, "ctrl") end
if bit.band(newModifiers, MODIFIER_L_ALT) == MODIFIER_L_ALT or bit.band(newModifiers, MODIFIER_R_ALT) == MODIFIER_R_ALT then table.insert(modifierNames, "alt") end
if bit.band(newModifiers, MODIFIER1) == MODIFIER1 then table.insert(modifierNames, "modifier1") end
if bit.band(newModifiers, MODIFIER_L_CTRL) == MODIFIER_L_CTRL or bit.band(newModifiers, MODIFIER_R_CTRL) == MODIFIER_R_CTRL then table.insert(modifierNames, "ctrl") end
if bit.band(newModifiers, MODIFIER_L_ALT) == MODIFIER_L_ALT or bit.band(newModifiers, MODIFIER_R_ALT) == MODIFIER_R_ALT then table.insert(modifierNames, "alt") end
if bit.band(newModifiers, MODIFIER1) == MODIFIER1 then table.insert(modifierNames, "modifier1") end
if bit.band(newModifiers, MODIFIER_L_ALT) == MODIFIER_L_ALT or bit.band(newModifiers, MODIFIER_R_ALT) == MODIFIER_R_ALT then table.insert(modifierNames, "alt") end
if bit.band(newModifiers, MODIFIER1) == MODIFIER1 then table.insert(modifierNames, "modifier1") end
if bit.band(newModifiers, MODIFIER2) == MODIFIER2 then table.insert(modifierNames, "modifier2") end
if bit.band(newModifiers, MODIFIER1) == MODIFIER1 then table.insert(modifierNames, "modifier1") end
if bit.band(newModifiers, MODIFIER2) == MODIFIER2 then table.insert(modifierNames, "modifier2") end
if bit.band(newModifiers, MODIFIER3) == MODIFIER3 then table.insert(modifierNames, "modifier3") end
if bit.band(newModifiers, MODIFIER2) == MODIFIER2 then table.insert(modifierNames, "modifier2") end
if bit.band(newModifiers, MODIFIER3) == MODIFIER3 then table.insert(modifierNames, "modifier3") end
if bit.band(newModifiers, MODIFIER4) == MODIFIER4 then table.insert(modifierNames, "modifier4") end
if bit.band(newModifiers, MODIFIER3) == MODIFIER3 then table.insert(modifierNames, "modifier3") end
if bit.band(newModifiers, MODIFIER4) == MODIFIER4 then table.insert(modifierNames, "modifier4") end
if bit.band(newModifiers, MODIFIER5) == MODIFIER5 then table.insert(modifierNames, "modifier5") end
if bit.band(newModifiers, MODIFIER4) == MODIFIER4 then table.insert(modifierNames, "modifier4") end
if bit.band(newModifiers, MODIFIER5) == MODIFIER5 then table.insert(modifierNames, "modifier5") end
if bit.band(newModifiers, MODIFIER6) == MODIFIER6 then table.insert(modifierNames, "modifier6") end
if bit.band(newModifiers, MODIFIER5) == MODIFIER5 then table.insert(modifierNames, "modifier5") end
if bit.band(newModifiers, MODIFIER6) == MODIFIER6 then table.insert(modifierNames, "modifier6") end
@/lua/ge/extensions/editor/api/gui.lua
if bit.band(io.ConfigFlags, imgui.ConfigFlags_DockingEnable) ~= 0 then
-- this adds a transparent window we can dock into
if editEnded then
if bit.band(extra_flags, imgui.InputTextFlags_EnterReturnsTrue) ~= 0 then
editEnded[0] = imgui.IsItemDeactivatedAfterEdit() or res
if editEnded then
if bit.band(extra_flags, imgui.InputTextFlags_EnterReturnsTrue) ~= 0 then
editEnded[0] = imgui.IsItemDeactivatedAfterEdit() or res
local intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateX) == InputFloat_IndeterminateX)
local res = false
res = uiInputFloatEx_componentInput(v, 0, id .. "_xcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateX)) valueChanged = true end
local width = (imgui.GetContentRegionAvailWidth() - style.ItemSpacing.x) / 2
local intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateX) == InputFloat_IndeterminateX)
res = uiInputFloatEx_componentInput(v, 0, id .. "_xcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 0, id .. "_xcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateX)) valueChanged = true end
imgui.SameLine()
imgui.SameLine()
intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateY) == InputFloat_IndeterminateY)
res = uiInputFloatEx_componentInput(v, 1, id .. "_ycomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 1, id .. "_ycomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateY)) valueChanged = true end
local width = (imgui.GetContentRegionAvailWidth() - style.ItemSpacing.x) / 3
local intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateX) == InputFloat_IndeterminateX)
res = uiInputFloatEx_componentInput(v, 0, id .. "_xcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 0, id .. "_xcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateX)) valueChanged = true end
imgui.SameLine()
imgui.SameLine()
intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateY) == InputFloat_IndeterminateY)
res = uiInputFloatEx_componentInput(v, 1, id .. "_ycomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 1, id .. "_ycomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateY)) valueChanged = true end
imgui.SameLine()
imgui.SameLine()
intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateZ) == InputFloat_IndeterminateZ)
res = uiInputFloatEx_componentInput(v, 2, id .. "_zcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 2, id .. "_zcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateZ)) valueChanged = true end
local width = (imgui.GetContentRegionAvailWidth() - style.ItemSpacing.x) / 4
local intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateX) == InputFloat_IndeterminateX)
res = uiInputFloatEx_componentInput(v, 0, id .. "_xcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 0, id .. "_xcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateX)) valueChanged = true end
imgui.SameLine()
imgui.SameLine()
intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateY) == InputFloat_IndeterminateY)
res = uiInputFloatEx_componentInput(v, 1, id .. "_ycomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 1, id .. "_ycomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateY)) valueChanged = true end
imgui.SameLine()
imgui.SameLine()
intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateZ) == InputFloat_IndeterminateZ)
res = uiInputFloatEx_componentInput(v, 2, id .. "_zcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 2, id .. "_zcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateZ)) valueChanged = true end
imgui.SameLine()
imgui.SameLine()
intermediate = flags ~= nil and (bit.band(flags, InputFloat_IndeterminateW) == InputFloat_IndeterminateW)
res = uiInputFloatEx_componentInput(v, 3, id .. "_wcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
res = uiInputFloatEx_componentInput(v, 3, id .. "_wcomponent", addStepButtons, step, step_fast, format, intermediate, editEnded, width)
if res then returnedIndeterminateFlags = bit.band(returnedIndeterminateFlags, bit.bnot(InputFloat_IndeterminateW)) valueChanged = true end
@/lua/ge/extensions/editor/dynamicDecalsTool.lua
if editor.uiIconImageButton(editor.icons.adjust, nil, (bit.band(api.getSettings(), api.settingsFlags.UseMousePos.value) == api.settingsFlags.UseMousePos.value) and editor.color.beamng.Value or nil, nil, nil, "ToggleUseMousePosToolbarButton") then
api.toggleSetting(api.settingsFlags.UseMousePos.value)
@/lua/ge/extensions/editor/sceneTree.lua
if node.filterResult then
if bit.band(node.filterResult, searchMatches[2]) ~= 0 and node.name ~= node.displayName then
nodeLabel = nodeLabel .. ' [name: ' .. node.name .. ']'
end
if bit.band(node.filterResult, searchMatches[3]) ~= 0 then
nodeLabel = nodeLabel .. ' [id: ' .. tostring(node.id) .. ']'
end
if bit.band(node.filterResult, searchMatches[4]) ~= 0 then
nodeLabel = nodeLabel .. ' [class: ' .. node.className .. ']'
if node.filterResult then
if bit.band(node.filterResult, searchMatches[2]) ~= 0 and node.name ~= node.displayName then
nodeLabel = nodeLabel .. ' [name: ' .. node.name .. ']'
end
if bit.band(node.filterResult, searchMatches[3]) ~= 0 then
nodeLabel = nodeLabel .. ' [id: ' .. tostring(node.id) .. ']'
end
if bit.band(node.filterResult, searchMatches[4]) ~= 0 then
nodeLabel = nodeLabel .. ' [class: ' .. node.className .. ']'
if node.filterResult then
if bit.band(node.filterResult, searchMatches[2]) ~= 0 and node.name ~= node.displayName then
nodeLabel = nodeLabel .. ' [name: ' .. node.name .. ']'
end
if bit.band(node.filterResult, searchMatches[3]) ~= 0 then
nodeLabel = nodeLabel .. ' [id: ' .. tostring(node.id) .. ']'
end
if bit.band(node.filterResult, searchMatches[4]) ~= 0 then
nodeLabel = nodeLabel .. ' [class: ' .. node.className .. ']'
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaController.lua
local function applyTouchInputs(x1Pos, x1Quadrant, y1Pos, x2Pos, x2Quadrant, y2Pos, touchState, counter)
local x1Sign = band(x1Quadrant, 0x01)
local x1 = x1Sign <= 0 and (-255 + x1Pos) or x1Pos
local y1 = y1Pos - 15
local x2Sign = band(x2Quadrant, 0x01)
local x2 = x2Sign <= 0 and (-255 + x2Pos) or x2Pos
--dump({x1, y1})
--dumpByte(band(x1Quadrant, 0xF0))
end
@/lua/ge/extensions/editor/dynamicDecals/settings.lua
local enabled = (bit.band(api.getSettings(), api.settingsFlags.UseMousePos.value) == api.settingsFlags.UseMousePos.value)
if im.Checkbox(api.settingsFlags.UseMousePos.name, editor.getTempBool_BoolBool(enabled)) then
@/lua/ge/extensions/editor/missionPlaybook/missionTreeViewer.lua
ui_flowgraph_editor.End()
if (bit.band(tonumber(ui_flowgraph_editor.GetDirtyReason()), ui_flowgraph_editor.Dirty_Position) ~= 0) then
dump("AD")
@/lua/ge/extensions/flowgraph/nodes/util/perlinNoise.lua
-- Calculate the "unit cube" that the point asked will be located in
local xi = bit32.band(math.floor(x),255)
local yi = bit32.band(math.floor(y),255)
local xi = bit32.band(math.floor(x),255)
local yi = bit32.band(math.floor(y),255)
local zi = bit32.band(math.floor(z),255)
local yi = bit32.band(math.floor(y),255)
local zi = bit32.band(math.floor(z),255)
function C:grad(hash, x, y, z)
return self.dot_product[bit32.band(hash,0xF)](x,y,z)
end
@/lua/vehicle/extensions/tech/CANBus/CANBusPeak.lua
local function lowByte(x)
return band(x, 0xFF)
end
local function fourBytes(x)
local lowerTwoBytes = band(x, 0xFFFF)
local upperTwoBytes = rshift(x, 16)
@/lua/ge/extensions/editor/resourceChecker/resourceUtil.lua
if hasBit and hasBit.band then
return hasBit.band(x, x - 1) == 0
end
@/lua/common/libs/lua-websockets/websocket/frame.lua
local encode_header_medium = function(header, payload, len)
return schar(header, payload, band(rshift(len, 8), 0xFF), band(len, 0xFF))
end
local encode_header_medium = function(header, payload, len)
return schar(header, payload, band(rshift(len, 8), 0xFF), band(len, 0xFF))
end
local bytes = 2
local fin = band(header,bit_7) > 0
local opcode = band(header,bit_0_3)
local fin = band(header,bit_7) > 0
local opcode = band(header,bit_0_3)
local mask = band(payload,bit_7) > 0
local opcode = band(header,bit_0_3)
local mask = band(payload,bit_7) > 0
payload = band(payload,bit_0_6)
local mask = band(payload,bit_7) > 0
payload = band(payload,bit_0_6)
if payload > 125 then
@/lua/common/libs/luamqtt/mqtt/protocol4.lua
local byte1, byte2 = parse_uint8(input.read_func), parse_uint8(input.read_func)
local sp = (band(byte1, 0x1) ~= 0)
return setmetatable({type=ptype, sp=sp, rc=byte2}, connack_packet_mt)
-- DOC: 3.3.1.1 DUP
local dup = (band(flags, 0x8) ~= 0)
-- DOC: 3.3.1.2 QoS
-- DOC: 3.3.1.2 QoS
local qos = band(rshift(flags, 1), 0x3)
-- DOC: 3.3.1.3 RETAIN
-- DOC: 3.3.1.3 RETAIN
local retain = (band(flags, 0x1) ~= 0)
-- DOC: 3.3.2.1 Topic Name
@/lua/ge/extensions/editor/materialEditor.lua
if not n or n <= 0 then return false end
return band(n, n - 1) == 0
end
if not worldEditorCppApi.getClassIsSelectable("TSStatic") then
defaultFlags = bit.band(defaultFlags, bit.bnot(SOTStaticShape))
end
"##" .. label .. property .. tostring(layer),
editor.getTempBool_StringString((band(animFlags, hex) == hex))
) then
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaKombi.lua
for _ = 0, 7 do
if band(crc, 0x80) ~= 0 then
crc = lshift(crc, 1)
end
return band(bxor(crc, xorOutput), 0xFF)
end
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)
@/lua/ge/extensions/editor/objectTool.lua
if not worldEditorCppApi.getClassIsSelectable("TSStatic") then
defaultFlags = bit.band(defaultFlags, bit.bnot(SOTStaticShape))
end
if not worldEditorCppApi.getClassIsSelectable("TSStatic") then
defaultFlags = bit.band(defaultFlags, bit.bnot(SOTStaticShape))
end
if not worldEditorCppApi.getClassIsSelectable("TSStatic") then
defaultFlags = bit.band(defaultFlags, bit.bnot(SOTStaticShape))
end
if not worldEditorCppApi.getClassIsSelectable("TSStatic") then
defaultFlags = bit.band(defaultFlags, bit.bnot(SOTStaticShape))
end
@/lua/common/libs/lua-websockets/websocket/tools.lua
local write_int16 = function(v)
return pack_bytes(rshift(v, 8), band(v, 0xFF))
end
return pack_bytes(
band(rshift(v, 24), 0xFF),
band(rshift(v, 16), 0xFF),
band(rshift(v, 24), 0xFF),
band(rshift(v, 16), 0xFF),
band(rshift(v, 8), 0xFF),
band(rshift(v, 16), 0xFF),
band(rshift(v, 8), 0xFF),
band(v, 0xFF)
band(rshift(v, 8), 0xFF),
band(v, 0xFF)
)
if i > 0 and i < 21 then
f = bor(band(b,c),band(bnot(b),d))
k = 0x5A827999
if i > 0 and i < 21 then
f = bor(band(b,c),band(bnot(b),d))
k = 0x5A827999
elseif i > 40 and i < 61 then
f = bor(band(b,c),band(b,d),band(c,d))
k = 0x8F1BBCDC
elseif i > 40 and i < 61 then
f = bor(band(b,c),band(b,d),band(c,d))
k = 0x8F1BBCDC
elseif i > 40 and i < 61 then
f = bor(band(b,c),band(b,d),band(c,d))
k = 0x8F1BBCDC
-- necessary on sizeof(int) == 32 machines
h0 = band(h0,0xffffffff)
h1 = band(h1,0xffffffff)
h0 = band(h0,0xffffffff)
h1 = band(h1,0xffffffff)
h2 = band(h2,0xffffffff)
h1 = band(h1,0xffffffff)
h2 = band(h2,0xffffffff)
h3 = band(h3,0xffffffff)
h2 = band(h2,0xffffffff)
h3 = band(h3,0xffffffff)
h4 = band(h4,0xffffffff)
h3 = band(h3,0xffffffff)
h4 = band(h4,0xffffffff)
@/lua/ge/extensions/editor/api/dynamicDecals.lua
M.isDecalGradientColorEnabled = function()
return (bit.band(decalProjection:getSettings(), M.settingsFlags.UseGradientColor.value) == M.settingsFlags.UseGradientColor.value)
end
M.isAlphaMaskInvertEnabled = function()
return (bit.band(decalProjection:getSettings(), M.settingsFlags.AlphaMaskInvert.value) == M.settingsFlags.AlphaMaskInvert.value)
end
M.isWrapAlphaMaskXEnabled = function()
return (bit.band(decalProjection:getSettings(), M.settingsFlags.WrapAlphaMaskX.value) == M.settingsFlags.WrapAlphaMaskX.value)
end
M.isWrapAlphaMaskYEnabled = function()
return (bit.band(decalProjection:getSettings(), M.settingsFlags.WrapAlphaMaskY.value) == M.settingsFlags.WrapAlphaMaskY.value)
end
M.isWrapColorTextureXEnabled = function()
return (bit.band(decalProjection:getSettings(), M.settingsFlags.WrapColorTextureX.value) == M.settingsFlags.WrapColorTextureX.value)
end
M.isWrapColorTextureYEnabled = function()
return (bit.band(decalProjection:getSettings(), M.settingsFlags.WrapColorTextureY.value) == M.settingsFlags.WrapColorTextureY.value)
end
M.isUseMousePos = function()
return (bit.band(decalProjection:getSettings(), M.settingsFlags.UseMousePos.value) == M.settingsFlags.UseMousePos.value)
end
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaShifter.lua
for _ = 0, 7 do
if band(crc, 0x80) ~= 0 then
crc = lshift(crc, 1)
end
return band(bxor(crc, xorOutput), 0xFF)
end
@/lua/ge/extensions/editor/shortcutLegend.lua
if type(controlFlag) == "number" then
if bit.band(controlFlag, modifierFlag) ~= 0 then
if not control then
if type(controlFlag) == "number" then
if bit.band(controlFlag, modifierFlag) ~= 0 then
if not control then
@/lua/ge/extensions/editor/flowgraph/main.lua
if (bit.band(tonumber(ui_flowgraph_editor.GetDirtyReason()), ui_flowgraph_editor.Dirty_Position) ~= 0) then --and im.IsMouseReleased(0) then
if self.mgr._ignoreMove then
@/lua/common/libs/luamqtt/mqtt/protocol.lua
end
return str_char(rshift(val, 8), band(val, 0xFF))
end
end
return str_char(rshift(val, 24), band(rshift(val, 16), 0xFF), band(rshift(val, 8), 0xFF), band(val, 0xFF))
end
end
return str_char(rshift(val, 24), band(rshift(val, 16), 0xFF), band(rshift(val, 8), 0xFF), band(val, 0xFF))
end
end
return str_char(rshift(val, 24), band(rshift(val, 16), 0xFF), band(rshift(val, 8), 0xFF), band(val, 0xFF))
end
byte = str_byte(byte, 1, 1)
val = val + band(byte, 127) * mult
if mult > max_mult then
mult = mult * 128
until band(byte, 128) == 0
return val
function protocol.make_header(ptype, flags, len)
local byte1 = bor(lshift(ptype, 4), band(flags, 0x0F))
return str_char(byte1, make_var_length(len))
local ptype = rshift(byte1, 4)
local flags = band(byte1, 0xF)
len, err = parse_var_length(read_func)
@/lua/ge/extensions/util/export.lua
local function sepbytes(num)
return bit.band(num,0xFF), bit.band(bit.rshift(num,8),0xFF), bit.band(bit.rshift(num,16),0xFF), bit.band(bit.rshift(num,24),0xFF);
end
local function sepbytes(num)
return bit.band(num,0xFF), bit.band(bit.rshift(num,8),0xFF), bit.band(bit.rshift(num,16),0xFF), bit.band(bit.rshift(num,24),0xFF);
end
local function sepbytes(num)
return bit.band(num,0xFF), bit.band(bit.rshift(num,8),0xFF), bit.band(bit.rshift(num,16),0xFF), bit.band(bit.rshift(num,24),0xFF);
end
local function sepbytes(num)
return bit.band(num,0xFF), bit.band(bit.rshift(num,8),0xFF), bit.band(bit.rshift(num,16),0xFF), bit.band(bit.rshift(num,24),0xFF);
end
@/lua/ge/extensions/editor/toolUtilities/perlin.lua
local function grad(hash, x, y)
local h = band(hash, 7) -- hash & 7
local u = h < 4 and x or y
local v = h < 4 and y or x
local res = ((band(h, 1) ~= 0) and -u or u) + ((band(h, 2) ~= 0) and -v or v)
return res
local v = h < 4 and y or x
local res = ((band(h, 1) ~= 0) and -u or u) + ((band(h, 2) ~= 0) and -v or v)
return res
function M.noise(x, y)
local X, Y = band(floor(x), 255), band(floor(y), 255)
local xf, yf = x - floor(x), y - floor(y)
function M.noise(x, y)
local X, Y = band(floor(x), 255), band(floor(y), 255)
local xf, yf = x - floor(x), y - floor(y)
local A = band(perm[X] + Y, 255)
local AA = perm[A]
local AA = perm[A]
local AB = perm[band(A + 1, 255)]
local B = band(perm[band(X + 1, 255)] + Y, 255)
local AB = perm[band(A + 1, 255)]
local B = band(perm[band(X + 1, 255)] + Y, 255)
local BA = perm[B]
local AB = perm[band(A + 1, 255)]
local B = band(perm[band(X + 1, 255)] + Y, 255)
local BA = perm[B]
local BA = perm[B]
local BB = perm[band(B + 1, 255)]
@/lua/common/libs/luamqtt/mqtt/protocol5.lua
byte1, byte2 = parse_uint8(read_data), parse_uint8(read_data)
local sp = (band(byte1, 0x1) ~= 0)
packet = setmetatable({type=ptype, sp=sp, rc=byte2}, connack_packet_mt)
-- DOC: 3.3.1.1 DUP
local dup = (band(flags, 0x8) ~= 0)
-- DOC: 3.3.1.2 QoS
-- DOC: 3.3.1.2 QoS
local qos = band(rshift(flags, 1), 0x3)
-- DOC: 3.3.1.3 RETAIN
-- DOC: 3.3.1.3 RETAIN
local retain = (band(flags, 0x1) ~= 0)
-- DOC: 3.3.2.1 Topic Name
@/lua/vehicle/extensions/tech/LINBus/LINBusPeak.lua
local function lowByte(x)
return band(x, 0xFF)
end
local function fourBytes(x)
local lowerTwoBytes = band(x, 0xFFFF)
local upperTwoBytes = rshift(x, 16)
@/lua/ge/extensions/editor/api/valueInspector.lua
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
fieldValue =
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
fieldValue =
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1]) .. " " .. tostring(self.input4FloatValue[2]) .. " " .. tostring(self.input4FloatValue[3])
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = undefinedInteger end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = undefinedInteger end
fieldValue = tostring(self.input4FloatValue[0]) .. " " .. tostring(self.input4FloatValue[1])
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
fieldValue =
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
fieldValue =
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
-- set the NaN value for elements that were not edited, engine will detect NaNs and will not set those elements on field setData
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateX) == editor.InputFloat_IndeterminateX then self.input4FloatValue[0] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateY) == editor.InputFloat_IndeterminateY then self.input4FloatValue[1] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateZ) == editor.InputFloat_IndeterminateZ then self.input4FloatValue[2] = 0/0 end
if bit.band(result.indeterminateFlags, editor.InputFloat_IndeterminateW) == editor.InputFloat_IndeterminateW then self.input4FloatValue[3] = 0/0 end