<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>B= map bitAnd: 7.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>M= map bitShift: -3.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>All the best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ron Teitelbaum<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> squeak-dev-bounces@lists.squeakfoundation.org [mailto:squeak-dev-bounces@lists.squeakfoundation.org] <b>On Behalf Of </b>gettimothy<br><b>Sent:</b> Tuesday, February 11, 2014 9:06 PM<br><b>To:</b> The general-purpose Squeak developers list<br><b>Subject:</b> [squeak-dev] for the operation MAP := B bitOr:( M bitShift:3) given MAP how do I derive B and M?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>To reverse a MorphicEvent into an primitive event I need to unmap the buttons and modifiers.<br>In a primitive event, the fifth element (buttons) can be 1,2 or 4 and the sixth element (modifiers)&nbsp; 1,2,4 or 8.<br><br>HandMorph &gt;&gt; generateMouseEvent combines them into one field as such:<br><br><o:p></o:p></span></p><div><p class=MsoNormal style='background:whitesmoke'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>&nbsp;&nbsp;&nbsp; buttons := evtBuf fifth.<br>&nbsp;&nbsp;&nbsp; modifiers := evtBuf sixth.<br>&nbsp;&nbsp;&nbsp; buttons := buttons bitOr: (modifiers bitShift: 3).<o:p></o:p></span></p></div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><br>I need to reverse that&nbsp;&nbsp; &quot;buttons bitOr: (modifiers bitShift: 3)&quot; back into the original values to recreate the primitive event.<br>Here are the possible values of B(uttons) and M(odifiers) under that operation:<br><br><br><b><u>B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MAP</u></b><br>1 bitOr:(1 bitShift:3 ) 9<br>1 bitOr:(2 bitShift:3 ) 17<br>1 bitOr:(4 bitShift:3 ) 33<br>1 bitOr:(8 bitShift:3 ) 65<br><br><br>2 bitOr:(1 bitShift:3 )&nbsp; 10<br>2 bitOr:(2 bitShift:3 )&nbsp; 18<br>2 bitOr:(4 bitShift:3 )&nbsp; 34<br>2 bitOr:(8 bitShift:3 )&nbsp; 66<br><br><br>4 bitOr:(1 bitShift:3 )&nbsp;&nbsp; 12<br>4 bitOr:(2 bitShift:3 )&nbsp;&nbsp; 20<br>4 bitOr:(4 bitShift:3 )&nbsp;&nbsp; 36<br>4 bitOr:(8 bitShift:3 )&nbsp;&nbsp; 68<br><br>So, given a MAP on the right, I need to derive a B and a M.<br><br>I can figure something out, but it will probably be ugly. Hence, this email to the list.<br>Any bit-fiddlers on the board who know an elegant method?<br><br>thx.<br><br>tty.<o:p></o:p></span></p></div></div></div></body></html>