Re: bitwise operations in obj C
Re: bitwise operations in obj C
- Subject: Re: bitwise operations in obj C
- From: Steve Israelson <email@hidden>
- Date: Wed, 17 Oct 2007 10:50:20 -0700
Can you keep track of line numbers differently?
int lineNumber;
int pageNumber;
int fraction;
++lineNumber;
if (++fraction == increment)
++pageNumber;
On 17-Oct-07, at 10:40 AM, Erfan Aleemullah wrote:
well, not exactly sure, but the program is nearing beta release, and
i'm
trying to eliminate leaks and increase efficiency. So, not exactly
sure if
i *absolutely need to do bit ops here, but it would definitely help,
because
the operation is done everytime the linenumbers increment themselves
- so
when the line number is 100,000, the code would have 'modulo'ed'
100,000
times and as the numbers get large themselves--> eg) 100,000 % 12 =
slightly
expensive yes?
On 10/17/07, Clark Cox <email@hidden> wrote:
On 10/17/07, Erfan Aleemullah <email@hidden> wrote:
hello all,
I have a modulus operation in my code and it runs fine, but my
original
algorithm avoided division all together for speed reasons - I am
using
modulus due to a change in requirements.
How exactly (or can I) use bit operations to achieve the same
effect and
increase my speed here ?
Are you sure that integer division is actually your bottleneck here?
Have you profiled you code?
Code:
line_Number++;
if(line_Number % increment == 0)
// lineNumber is any
integer
value > 0, can get large w/ time - 100,000++
{ // increment is user
selectable
integer from a set of given values
....
....
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden