• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reading in dictionary from txt file: options for speed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Reading in dictionary from txt file: options for speed
      • From: Michael Ash <email@hidden>
References: 
 >Reading in dictionary from txt file: options for speed (From: Miles <email@hidden>)
 >Re: Reading in dictionary from txt file: options for speed (From: Kyle Sluder <email@hidden>)
 >Re: Reading in dictionary from txt file: options for speed (From: Michael Ash <email@hidden>)
 >Re: Reading in dictionary from txt file: options for speed (From: Kyle Sluder <email@hidden>)
 >Re: Reading in dictionary from txt file: options for speed (From: Michael Ash <email@hidden>)
 >Re: Reading in dictionary from txt file: options for speed (From: Michael Ash <email@hidden>)

  • Prev by Date: The efficiency of swapping endianness on an iPhone?
  • Next by Date: Re: The efficiency of swapping endianness on an iPhone?
  • Previous by thread: Re: Reading in dictionary from txt file: options for speed
  • Next by thread: Re: Reading in dictionary from txt file: options for speed
  • Index(es):
    • Date
    • Thread