pipebuffer: Consider 0 as no alignment needed.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 30 Jan 2009 14:06:25 +0000 (14:06 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 30 Jan 2009 14:06:25 +0000 (14:06 +0000)
src/gallium/auxiliary/pipebuffer/pb_buffer.h

index 7cba5fa441cb62659c7ad89af5e5f4309879ffd9..d8f1f02d681b792f40c8f8fa8200983528767760 100644 (file)
@@ -255,7 +255,13 @@ pb_reference(struct pb_buffer **dst,
 static INLINE boolean
 pb_check_alignment(size_t requested, size_t provided)
 {
-   return requested <= provided && (provided % requested) == 0 ? TRUE : FALSE;
+   if(!requested)
+      return TRUE;
+   if(requested > provided)
+      return FALSE;
+   if(provided % requested != 0)
+      return FALSE;
+   return TRUE;
 }