Re: [Mesa-dev] [PATCH 4/7] mesa: Make bitset.h not rely on Mesa-specific types and functions.

2015-02-20 Thread Jose Fonseca

On 12/02/15 00:48, Eric Anholt wrote:

Note that we can't use u_math.h's align() because it's a function instead
of a macro, while BITSET_DECLARE needs a constant expression for nouveau's
usage in global declarations.
---
  src/mesa/main/bitset.h | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
index 2558da4..6f9bed9 100644
--- a/src/mesa/main/bitset.h
+++ b/src/mesa/main/bitset.h
@@ -31,19 +31,18 @@
  #ifndef BITSET_H
  #define BITSET_H

-#include imports.h
-#include macros.h
+#include util/u_math.h

  /
   * generic bitset implementation
   */

-#define BITSET_WORD GLuint
+#define BITSET_WORD unsigned int
  #define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)

  /* bitset declarations
   */
-#define BITSET_WORDS(bits) (ALIGN(bits, BITSET_WORDBITS) / BITSET_WORDBITS)
+#define BITSET_WORDS(bits) ((bits + BITSET_WORDBITS - 1) / BITSET_WORDBITS)


bits - (bits)

just in case...


  #define BITSET_DECLARE(name, bits) BITSET_WORD name[BITSET_WORDS(bits)]

  /* bitset operations



With it

Reviewed-by: Jose Fonseca jfons...@vmware.com

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/7] mesa: Make bitset.h not rely on Mesa-specific types and functions.

2015-02-11 Thread Matt Turner
On Wed, Feb 11, 2015 at 4:48 PM, Eric Anholt e...@anholt.net wrote:
 Note that we can't use u_math.h's align() because it's a function instead
 of a macro, while BITSET_DECLARE needs a constant expression for nouveau's
 usage in global declarations.
 ---
  src/mesa/main/bitset.h | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

 diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
 index 2558da4..6f9bed9 100644
 --- a/src/mesa/main/bitset.h
 +++ b/src/mesa/main/bitset.h
 @@ -31,19 +31,18 @@
  #ifndef BITSET_H
  #define BITSET_H

 -#include imports.h
 -#include macros.h
 +#include util/u_math.h

  /
   * generic bitset implementation
   */

 -#define BITSET_WORD GLuint
 +#define BITSET_WORD unsigned int
  #define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)

I don't think I realized BITSET_WORD was 32-bit on amd64. I had an
apparently false memory of you changing this to a 64-bit type and
getting a bit speed up on orbital explorer's gs compilation (commit
415d6dc5).

Maybe as a follow on patch, what do you think about using
uint_fast32_t (which is 64-bit on amd64) for BITSET_WORD? Of course
MSVC probably doesn't support that either.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/7] mesa: Make bitset.h not rely on Mesa-specific types and functions.

2015-02-11 Thread Eric Anholt
Note that we can't use u_math.h's align() because it's a function instead
of a macro, while BITSET_DECLARE needs a constant expression for nouveau's
usage in global declarations.
---
 src/mesa/main/bitset.h | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
index 2558da4..6f9bed9 100644
--- a/src/mesa/main/bitset.h
+++ b/src/mesa/main/bitset.h
@@ -31,19 +31,18 @@
 #ifndef BITSET_H
 #define BITSET_H
 
-#include imports.h
-#include macros.h
+#include util/u_math.h
 
 /
  * generic bitset implementation
  */
 
-#define BITSET_WORD GLuint
+#define BITSET_WORD unsigned int
 #define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)
 
 /* bitset declarations
  */
-#define BITSET_WORDS(bits) (ALIGN(bits, BITSET_WORDBITS) / BITSET_WORDBITS)
+#define BITSET_WORDS(bits) ((bits + BITSET_WORDBITS - 1) / BITSET_WORDBITS)
 #define BITSET_DECLARE(name, bits) BITSET_WORD name[BITSET_WORDS(bits)]
 
 /* bitset operations
-- 
2.1.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/7] mesa: Make bitset.h not rely on Mesa-specific types and functions.

2015-02-11 Thread Ian Romanick
On 02/11/2015 04:59 PM, Matt Turner wrote:
 On Wed, Feb 11, 2015 at 4:48 PM, Eric Anholt e...@anholt.net wrote:
 Note that we can't use u_math.h's align() because it's a function instead
 of a macro, while BITSET_DECLARE needs a constant expression for nouveau's
 usage in global declarations.
 ---
  src/mesa/main/bitset.h | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

 diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
 index 2558da4..6f9bed9 100644
 --- a/src/mesa/main/bitset.h
 +++ b/src/mesa/main/bitset.h
 @@ -31,19 +31,18 @@
  #ifndef BITSET_H
  #define BITSET_H

 -#include imports.h
 -#include macros.h
 +#include util/u_math.h

  
 /
   * generic bitset implementation
   */

 -#define BITSET_WORD GLuint
 +#define BITSET_WORD unsigned int
  #define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)
 
 I don't think I realized BITSET_WORD was 32-bit on amd64. I had an
 apparently false memory of you changing this to a 64-bit type and
 getting a bit speed up on orbital explorer's gs compilation (commit
 415d6dc5).
 
 Maybe as a follow on patch, what do you think about using
 uint_fast32_t (which is 64-bit on amd64) for BITSET_WORD? Of course
 MSVC probably doesn't support that either.

Doesn't matter. :) 'grep -r uint_fast32 include/'

include/c99/stdint.h:typedef uint32_t  uint_fast32_t;

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev