> > high, low = ((num % 2**16) >> 8, num % 2**8) or something thereabouts.
My take would be something like
high, low = (num >> 8) & 0xff , num & 0xff
In case you want another option. This is probably more
efficient since you're not raising to powers or taking the
modulus, although for all I kn
I'm not sure if those values are correct; I can check later tonight,
but I'm doing some statechart diagrams for class right now. They
sound reasonable but I can't be sure.
On Mon, Oct 20, 2008 at 11:20 AM, shawn bright <[EMAIL PROTECTED]> wrote:
> jeez, i screwed up, i ment num = 600, not 6
> th
No, I'm not sure what you mean.
Given this number
100101010101101011
the operation will slice off bits on the left with the % 2**16 so that
we only have 16 bits,
0101010101101011
then it will shift this value to the right so that we only have the
highest 8 bits
01010101
that will be stored in hig
thanks, Luke,
got me started anyway.
shawn
On Mon, Oct 20, 2008 at 11:23 AM, Luke Paireepinart
<[EMAIL PROTECTED]> wrote:
> I'm not sure if those values are correct; I can check later tonight,
> but I'm doing some statechart diagrams for class right now. They
> sound reasonable but I can't be su
jeez, i screwed up, i ment num = 600, not 6
thanks
On Mon, Oct 20, 2008 at 11:16 AM, Luke Paireepinart
<[EMAIL PROTECTED]> wrote:
> No, I'm not sure what you mean.
> Given this number
>
> 100101010101101011
>
> the operation will slice off bits on the left with the % 2**16 so that
> we only have 1
so using this, if num ==6, then i should get 2 and 88 ?
thanks, just checking to make sure i get what you wrote.
shawn
On Mon, Oct 20, 2008 at 11:00 AM, Luke Paireepinart
<[EMAIL PROTECTED]> wrote:
> -- Forwarded message --
> From: Luke Paireepinart <[EMAIL PROTECTED]>
> Date: Mon,
-- Forwarded message --
From: Luke Paireepinart <[EMAIL PROTECTED]>
Date: Mon, Oct 20, 2008 at 11:00 AM
Subject: Re: [Tutor] how to see a number as two bytes
To: shawn bright <[EMAIL PROTECTED]>
high, low = ((num % 2**16) >> 8, num % 2**8) or something thereabouts.
On Mon, Oct 2