packages: liboil/liboil-fixes.patch - so much unaligned write access doesn'...
sparky
sparky at pld-linux.org
Sun May 3 03:53:42 CEST 2009
Author: sparky Date: Sun May 3 01:53:42 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- so much unaligned write access doesn't seem like a good idea
---- Files affected:
packages/liboil:
liboil-fixes.patch (1.4 -> 1.5)
---- Diffs:
================================================================
Index: packages/liboil/liboil-fixes.patch
diff -u packages/liboil/liboil-fixes.patch:1.4 packages/liboil/liboil-fixes.patch:1.5
--- packages/liboil/liboil-fixes.patch:1.4 Sun May 3 03:11:56 2009
+++ packages/liboil/liboil-fixes.patch Sun May 3 03:53:37 2009
@@ -10,3 +10,56 @@
dest[i] = atmp[0];
if (i+1<n) dest[i+1] = atmp[1];
+--- liboil-0.3.16/liboil/copy/splat_ref.c 2007-11-16 03:53:47.000000000 +0100
++++ liboil-0.3.16.fix/liboil/copy/splat_ref.c 2009-05-03 03:37:00.000000000 +0200
+@@ -101,18 +101,40 @@
+ #ifdef HAVE_UNALIGNED_ACCESS
+ static void splat_u8_ns_int (uint8_t *dest, const uint8_t *param, int n)
+ {
+- int p;
+- while(n&3) {
+- *dest = *param;
+- dest++;
+- n--;
++ int i;
++ uint32_t p, *dest32;
++ size_t diff;
++
++ if(n<4) {
++ for ( i=0; i<n; i++) {
++ dest[i] = *param;
++ }
++ return;
+ }
+- n >>= 2;
++
+ p = (*param<<24) | (*param<<16) | (*param<<8) | (*param);
+- while(n>0){
+- *(uint32_t *)dest = p;
+- dest+=4;
+- n--;
++
++ dest32 = (void *)dest;
++ dest32[0] = p; /* may be unaligned */
++
++ /* align */
++ dest32 += 1;
++ dest32 = (void *)( ((uintptr_t)dest32) & (~3) );
++ diff = (void *)dest32 - (void *)dest;
++
++ n -= diff;
++ diff = n & 3;
++ n >>= 2;
++ /* aligned copy */
++ for( i=0; i<n; i++) {
++ dest32[i] = p;
++ }
++ dest32 += n;
++
++ /* unaligned */
++ if ( diff ) {
++ dest32 = (void *) ((uintptr_t)dest32 + diff - 4);
++ dest32[0] = p;
+ }
+ }
+ OIL_DEFINE_IMPL(splat_u8_ns_int, splat_u8_ns);
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/liboil/liboil-fixes.patch?r1=1.4&r2=1.5&f=u
More information about the pld-cvs-commit
mailing list