<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style='font-size:10pt;font-family:Verdana,Arial,Helvetica,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, "Ok, its close to 64 that means its this, so do that" 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><br><div id="1"><br>---- On Tue, 11 Feb 2014 19:49:12 -0800 <b>Ron Teitelbaum&lt;ron@usmedrec.com&gt;</b> wrote ---- <br></div><br><blockquote style="border-left: 1px solid #0000FF; padding-left: 6px; margin:0 0 0 5px"><div link="blue" vlink="purple" lang="EN-US"><div><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">Hello,</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">&nbsp;</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">B= map bitAnd: 7.</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">M= map bitShift: -3.</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">&nbsp;</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">All the best,</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">&nbsp;</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">Ron Teitelbaum</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">&nbsp;</span></p><p><span style="font-size:11.0pt;font-family:calibri,sans-serif;color:#1f497d">&nbsp;</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 subj="" mailid="squeak-dev-bounces%40lists.squeakfoundation.org" href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a> [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?</span></p></div></div><p></p>&nbsp;<p></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:<br><br></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).</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; "buttons bitOr: (modifiers bitShift: 3)" 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.</span></p></div></div></div> <br></div></blockquote><br></div></body></html>