[#4595] New block syntax — Daniel Amelang <daniel.amelang@...>

I'm really sorry if this isn't the place to talk about this. I've

25 messages 2005/03/21
[#4606] Re: New block syntax — "David A. Black" <dblack@...> 2005/03/21

Hi --

[#4629] Re: New block syntax — "Sean E. Russell" <ser@...> 2005/03/30

On Monday 21 March 2005 16:17, David A. Black wrote:

[#4648] about REXML::Encoding — speakillof <speakillof@...>

Hi.

15 messages 2005/03/31
[#4659] Re: about REXML::Encoding — "Sean E. Russell" <ser@...> 2005/04/04

On Thursday 31 March 2005 09:44, speakillof wrote:

Re: Integer.odd?/.even?

From: Brent Roman <brent@...>
Date: 2005-03-04 19:29:22 UTC
List: ruby-core #4516
Hi,

Well, I'm an old assembly language geek, so...
How about this pure-Ruby implementation for odd/even?

class Integer
  def odd
      self & 1 != 0
   end
  def even
      self & 1 == 0
  end
end


---

Should be wicked fast.
No fancy method calls, division or modulo ops.

- brent



-- 
 Brent Roman                                   MBARI
 Software Engineer               Tel: (831) 775-1808
 7700 Sandholdt Road,         Moss Landing, CA 95039
 mailto:brent@mbari.org  http://www.mbari.org/~brent


In This Thread

Prev Next