// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Zigzag small signed integers // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set VALUE within minus1000000 through1000000. Owner touch runs the local demonstration. // Stop / restore: Disable/remove. No external requests or scene changes occur; reset clears memory. // Notes: Useful before variable-length encoding. The chosen cap avoids overflow; zigzag alone does not reduce LSL integer storage. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Local owner-only protocol laboratory. integer VALUE=-37; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(VALUE< -1000000||VALUE>1000000) { llOwnerSay("Input outside demonstration range."); return; } integer encoded=2*VALUE; if(VALUE<0)encoded=-2*VALUE-1; integer decoded=encoded/2; if(encoded&1)decoded=-(encoded+1)/2; llOwnerSay("Encoded="+(string)encoded+"; decoded="+(string)decoded); } }