![]() |
| | #1 |
| 3735928559 Join Date: Mar 2008
Posts: 662
| fast checking for alignment Code: //...
unsigned char* index1 = memberDataBlock;
unsigned char* index2 = someOtherDataBlock;
while(index1%16||index2%16)
{
*index1++ |= *index2++;
}
//...
please feel free to move this to the C forum if it is deemed more appropriate |
| m37h0d is offline | |
| | #2 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| "while (index1&0xF)" perhaps? |
| tabstop is offline | |
| | #3 |
| 3735928559 Join Date: Mar 2008
Posts: 662
| aaaah yes. your use of hex has made my careless error immediately obvious. index&0xF , not index&16 edit: thanks! Last edited by m37h0d; 08-10-2009 at 01:24 PM. |
| m37h0d is offline | |
| | #4 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,379
| Quote:
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot | |
| brewbuck is online now | |
| | #5 | |
| 3735928559 Join Date: Mar 2008
Posts: 662
| you sure? Code: while(index1&0xF||index2&0xF) Quote:
Last edited by m37h0d; 08-10-2009 at 01:41 PM. | |
| m37h0d is offline | |
| | #6 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| |
| tabstop is offline | |
| | #7 |
| 3735928559 Join Date: Mar 2008
Posts: 662
| yes, i need them both aligned. and brewbuck's right. the addresses in my test just happened to be 16B aligned already. |
| m37h0d is offline | |
| | #8 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,379
| Quote:
It's extremely difficult to write efficient SIMD algorithms when you aren't in control of the original alignment.
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot | |
| brewbuck is online now | |
| | #9 |
| 3735928559 Join Date: Mar 2008
Posts: 662
| in this case, i can be, but it may not be the case forever. the buffers in this case are data buffers for a piece of hardware. the driver for the particular piece of equipment has an option to use a user-defined buffer. future HW selections may not; thus necessitating nasty superfluous memcpys. i doubt that's really much of an issue though, because this is honestly the first piece of hw i've seen whose driver attempts to manage it's own memory on the client side. |
| m37h0d is offline | |
| | #10 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,379
| Quote:
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot | |
| brewbuck is online now | |
| | #11 |
| 3735928559 Join Date: Mar 2008
Posts: 662
| yes, curious that it invariably was 16+B aligned, but the documentation doesn't guarantee it. sadly the user-buffer option is not working according to spec :grumble: |
| m37h0d is offline | |
![]() |
| Tags |
| alignment intrinsics |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Buidl Library with ./configure script | Jardon | C Programming | 6 | 07-24-2009 09:36 AM |
| Profiler Valgrind | afflictedd2 | C++ Programming | 4 | 07-18-2008 09:38 AM |
| Interpreter.c | moussa | C Programming | 4 | 05-28-2008 05:59 PM |
| Forced moves trouble!! | Zishaan | Game Programming | 0 | 03-27-2007 06:57 PM |
| Problems about gcc installation | kevin_cat | Linux Programming | 4 | 08-09-2005 09:05 AM |