Re: Reading in dictionary from txt file: options for speed
Re: Reading in dictionary from txt file: options for speed
- Subject: Re: Reading in dictionary from txt file: options for speed
- From: Kyle Sluder <email@hidden>
- Date: Tue, 14 Apr 2009 20:26:34 -0400
On Tue, Apr 14, 2009 at 7:27 PM, Michael Ash <email@hidden> wrote:
> I should specify, it has no trouble reading a misaligned int pointer
> *in x86-64 mode*. I did actually test it that way, although the first
> time I ran the test I compiled it 32-bit and then felt kind of
> stupid....
You're right, I haven't been able to do it myself. Apparently you can
set a flag to cause the CPU to generate alignment exceptions, but I
can't seem to get it to happen:
int main(int argc, const char *argv[]) {
// Supposed to set the flag to cause
// misalignment exception to bubble up
asm("pushfq\n\t"
"popq %rax\n\t"
"orq $0x40000,%rax\n\t"
"pushq %rax\n\t"
"popfq");
unsigned long i = 18446744073709551615UL;
char *x = (char *)(&i) + 1;
int *y = (int *)x;
(*y) += 2;
return *x;
}
--Kyle Sluder
_______________________________________________
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