Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. 16 Byte alignment support

16 Byte alignment support

Scheduled Pinned Locked Moved C / C++ / MFC
c++delphiperformancequestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Remco Hoogenboezem
    wrote on last edited by
    #1

    I would like to align some static variables (floats) to 16 byte boundary's so I can use SSE instructions to speed up calculations. In microsoft visual C++ this is very simple: __declspec(align(16)) float A[65536]; &A[0]=0x???????0 But for my current project I have to use Borland C++ compiler. The Borland compiler does not support the align keyword. It is very easy to align dynamic variables to 16 byte boundary's using the function VirtualAlloc: lpAddress=VirtualAlloc(NULL,65536*4,MEM_COMMIT,PAGE_READWRITE); lpAddress=0x????0000 But if it is possible I would like to use static variables. I have tryed the following: typedef struct { CHAR cPadding[16]; }PADDING; #pragma pack(16) PADDING padding; FLOAT A[65536]; #pragma pack() #pragma pack(16) LONG DOUBLE padding1; LONG padding2; SHORT padding3; FLOAT A[65536]; #pragma pack() but this does not work. Does anyone have experience with this?? Thank You in advance:)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups