<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:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.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'>Yep.  That is exactly right.  <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'>It’s all just 1’s and 0’s </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><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<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><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> Wednesday, February 12, 2014 6:44 AM<br><b>To:</b> The general-purpose Squeak developers list&nbsp;&nbsp;&nbsp;&nbsp;<br><b>Subject:</b> RE: [squeak-dev] for the operation MAP := B bitOr:( M bitShift:3)&nbsp;&nbsp;&nbsp;&nbsp;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"'>David and Ron.<br><br>Thank you. <br><br>Its been decades since I have done any bit manipulation and I froze up (:<br><br>The answer came to me last night when I half-asleep.<br><br>It is clear now what was going on. Somebody needed the data in one field, so they scooched the modifiers up to the next three bits and then tacked on the button.<br><br>To reverse this I need to unscooch and un-tack.<br><br>When I posted&nbsp; the question, I was looking at MAP and thinking, &quot;Ok, its close to 64 that means its this, so do that&quot; which is way off base.<br><br><br>Sorry for the noise; I am better now (:<br><br><br>humbly.<br><br><br>tty<br><br><br><o:p></o:p></span></p><div id=1><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><br>---- On Tue, 11 Feb 2014 19:49:12 -0800 <b>Ron Teitelbaum&lt;<a href="mailto:ron@usmedrec.com">ron@usmedrec.com</a>&gt;</b> wrote ---- <o:p></o:p></span></p></div><blockquote style='border:none;border-left:solid blue 1.0pt;padding:0in 0in 0in 5.0pt;margin-left:3.75pt;margin-right:0in'><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p><div><div><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hello,</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>B= map bitAnd: 7.</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>M= map bitShift: -3.</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>All the best,</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ron Teitelbaum</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p><p><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></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><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"'> <a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a> [<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org">mailto:squeak-dev-bounces@lists.squeakfoundation.org</a>] <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?</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p></o:p></span></p></div></div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>&nbsp;<o:p></o:p></span></p><div><p 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:<o:p></o:p></span></p><div><p 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 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><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p></div></blockquote><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p></div></div></div></body></html>