<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Parrot - Bitwise Opcodes</title> <link rel="stylesheet" type="text/css" href="../../../resources/parrot.css" media="all"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="wrapper"> <div id="header"> <a href="http://www.parrot.org"> <img border=0 src="../../../resources/parrot_logo.png" id="logo" alt="parrot"> </a> </div> <!-- "header" --> <div id="divider"></div> <div id="mainbody"> <div id="breadcrumb"> <a href="../../../html/index.html">Home</a> » <a href="../../../html/ops.html">Opcodes</a> » Bitwise Opcodes </div> <h1><a name="NAME" >NAME</a></h1> <p>bit.ops - Bitwise Opcodes</p> <h1><a name="DESCRIPTION" >DESCRIPTION</a></h1> <p>Operations that deal with bits directly, either individually or in groups.</p> <p>The variant with an appended <b>s</b> like <b>bands</b> work on strings.</p> <p>When making changes to any ops file, run <code>make bootstrap-ops</code> to regenerate all generated ops files.</p> <dl> <dt><a name="band(inout_INT,_in_INT)" ><b>band</b>(inout INT, in INT)</a></dt> Set the bits of $1 according to the <b>and</b> of the corresponding bits from $1 and $2. <dt><a name="band(out_INT,_in_INT,_in_INT)" ><b>band</b>(out INT, in INT, in INT)</a></dt> Set the bits of $1 according to the <b>and</b> of the corresponding bits from $2 and $3. <dt><a name="bor(inout_INT,_in_INT)" ><b>bor</b>(inout INT, in INT)</a></dt> Set the bits of $1 according to the <b>or</b> of the corresponding bits from $1 and $2. <dt><a name="bor(out_INT,_in_INT,_in_INT)" ><b>bor</b>(out INT, in INT, in INT)</a></dt> Set the bits of $1 according to the <b>or</b> of the corresponding bits from $2 and $3. <dt><a name="shl(inout_INT,_in_INT)" ><b>shl</b>(inout INT, in INT)</a></dt> Shift left $1 by $2 bits. <dt><a name="shl(out_INT,_in_INT,_in_INT)" ><b>shl</b>(out INT, in INT, in INT)</a></dt> Set $1 to the value of $2 shifted left by $3 bits. <dt><a name="shr(inout_INT,_in_INT)" ><b>shr</b>(inout INT, in INT)</a></dt> Shift right $1 by $2 bits. <dt><a name="shr(out_INT,_in_INT,_in_INT)" ><b>shr</b>(out INT, in INT, in INT)</a></dt> Set $1 to the value of $2 shifted right by $3 bits. <dt><a name="lsr(out_INT,_in_INT)" ><b>lsr</b>(out INT, in INT)</a></dt> Shift $1 logically shifted right by $2 bits. <dt><a name="lsr(out_INT,_in_INT,_in_INT)" ><b>lsr</b>(out INT, in INT, in INT)</a></dt> Set $1 to the value of $2 logically shifted right by $3 bits. <dt><a name="bxor(inout_INT,_in_INT)" ><b>bxor</b>(inout INT, in INT)</a></dt> Set the bits of $1 according to the <b>xor</b> of the corresponding bits from $1 and $2. <dt><a name="bxor(out_INT,_in_INT,_in_INT)" ><b>bxor</b>(out INT, in INT, in INT)</a></dt> Set the bits of $1 according to the <b>xor</b> of the corresponding bits from $2 and $3.</dl> <h1><a name="COPYRIGHT" >COPYRIGHT</a></h1> <p>Copyright (C) 2001-2010, Parrot Foundation.</p> <h1><a name="LICENSE" >LICENSE</a></h1> <p>This program is free software. It is subject to the same license as the Parrot interpreter itself.</p> </div> <!-- "mainbody" --> <div id="divider"></div> <div id="footer"> Copyright © 2002-2011, Parrot Foundation. </div> </div> <!-- "wrapper" --> </body> </html>