Skip to main content

Bug Tracker

Side navigation

#1318 closed enhancement (fixed)

Opened June 23, 2007 08:05PM UTC

Closed May 16, 2008 02:34AM UTC

save some bytes in grep

Reported by: rformato Owned by:
Priority: minor Milestone: 1.2.4
Component: core Version: 1.1.2
Keywords: Cc:
Blocked by: Blocking:
Description

Hi,

we can save save bytes in grep replacing the line

if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )

with

if ( !inv != !fn(elems[i],i) )
Attachments (1)
  • grep.patch (0.4 KB) - added by rformato June 23, 2007 08:06PM UTC.

    Patch

Change History (4)

Changed May 12, 2008 01:22AM UTC by flesler comment:1

milestone: 1.1.31.2.4
resolution: → fixed
status: newclosed

Nice one, applied at [5558].

Changed May 12, 2008 08:49AM UTC by Markus.Staab comment:2

if (!a != !b)

you could save another few bytes with

a != b

ne two negations are not neccesarry..

Changed May 12, 2008 08:49AM UTC by Markus.Staab comment:3

resolution: fixed
status: closedreopened

Changed May 16, 2008 02:34AM UTC by flesler comment:4

resolution: → fixed
status: reopenedclosed

Wrong, a could be null, and b, false.. or a similar case. Casting both to bolean ensures equality.

Please reopen if you disagree.