Thanks Stephen, I appreciate the help.

On Fri, Mar 11, 2011 at 4:55 PM, Stephen Waits <[email protected]> wrote:

> On 03/11/11 16:44, Stephen Waits wrote:
>
>>
>> Here's another version that doesn't require you specify the number of
>> bytes:
>>
>
> Whoops, broken on negative numbers (and so obviously also on two's
> complement of positive numbers) because my loop will never end.
>
> No time to hack on it now though. If nobody posts a proper solution, I'll
> get you one this evening.
>
> Also..
>
> class Fixnum
>  def twos_complement
>    (~self) + 1
>  end
> end
>
>
> --Steve
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
>

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to