[Mesa-dev] [PATCH 1/4] util: import CRC32 implementation from gallium

Marek Olšák maraeo at gmail.com
Tue Nov 22 01:20:32 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/auxiliary/Makefile.sources                |  2 --
 src/gallium/drivers/radeonsi/si_state_shaders.c       |  2 +-
 src/util/Makefile.sources                             |  2 ++
 src/{gallium/auxiliary/util/u_hash.c => util/crc32.c} |  4 ++--
 src/{gallium/auxiliary/util/u_hash.h => util/crc32.h} | 12 ++++++------
 5 files changed, 11 insertions(+), 11 deletions(-)
 rename src/{gallium/auxiliary/util/u_hash.c => util/crc32.c} (98%)
 rename src/{gallium/auxiliary/util/u_hash.h => util/crc32.h} (92%)

diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources
index 3fda2eb..5d4fe30 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -243,22 +243,20 @@ C_SOURCES := \
 	util/u_format_yuv.h \
 	util/u_format_zs.c \
 	util/u_format_zs.h \
 	util/u_framebuffer.c \
 	util/u_framebuffer.h \
 	util/u_gen_mipmap.c \
 	util/u_gen_mipmap.h \
 	util/u_half.h \
 	util/u_handle_table.c \
 	util/u_handle_table.h \
-	util/u_hash.c \
-	util/u_hash.h \
 	util/u_hash_table.c \
 	util/u_hash_table.h \
 	util/u_helpers.c \
 	util/u_helpers.h \
 	util/u_index_modify.c \
 	util/u_index_modify.h \
 	util/u_inlines.h \
 	util/u_keymap.c \
 	util/u_keymap.h \
 	util/u_linear.c \
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index cd4b339..fd0be30 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -25,21 +25,21 @@
  *      Marek Olšák <maraeo at gmail.com>
  */
 
 #include "si_pipe.h"
 #include "sid.h"
 #include "radeon/r600_cs.h"
 
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_ureg.h"
 #include "util/hash_table.h"
-#include "util/u_hash.h"
+#include "util/crc32.h"
 #include "util/u_memory.h"
 #include "util/u_prim.h"
 
 /* SHADER_CACHE */
 
 /**
  * Return the TGSI binary in a buffer. The first 4 bytes contain its size as
  * integer.
  */
 static void *si_get_tgsi_binary(struct si_shader_selector *sel)
diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
index b7ca347..d2ae5e7 100644
--- a/src/util/Makefile.sources
+++ b/src/util/Makefile.sources
@@ -1,14 +1,16 @@
 MESA_UTIL_FILES :=	\
 	bitscan.c \
 	bitscan.h \
 	bitset.h \
+	crc32.c \
+	crc32.h \
 	debug.c \
 	debug.h \
 	disk_cache.c \
 	disk_cache.h \
 	format_r11g11b10f.h \
 	format_rgb9e5.h \
 	format_srgb.h \
 	half_float.c \
 	half_float.h \
 	hash_table.c	\
diff --git a/src/gallium/auxiliary/util/u_hash.c b/src/util/crc32.c
similarity index 98%
rename from src/gallium/auxiliary/util/u_hash.c
rename to src/util/crc32.c
index b67653e..44d637c 100644
--- a/src/gallium/auxiliary/util/u_hash.c
+++ b/src/util/crc32.c
@@ -20,27 +20,27 @@
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 /**
  * @file
- * Hash functions implementation.
+ * CRC32 implementation.
  * 
  * @author Jose Fonseca
  */
 
 
-#include "u_hash.h"
+#include "crc32.h"
 
 
 static const uint32_t 
 util_crc32_table[256] = {
    0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 
    0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 
    0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 
    0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 
    0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 
    0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 
diff --git a/src/gallium/auxiliary/util/u_hash.h b/src/util/crc32.h
similarity index 92%
rename from src/gallium/auxiliary/util/u_hash.h
rename to src/util/crc32.h
index 8d92b07..b6a21f4 100644
--- a/src/gallium/auxiliary/util/u_hash.h
+++ b/src/util/crc32.h
@@ -20,36 +20,36 @@
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 
 /**
  * @file
- * Hash functions.
+ * CRC32 function.
  * 
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
-#ifndef U_HASH_H_
-#define U_HASH_H_
+#ifndef CRC32_H_
+#define CRC32_H_
 
-
-#include "pipe/p_compiler.h"
+#include <stdlib.h>
+#include <stdint.h>
 
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
    
 uint32_t
 util_hash_crc32(const void *data, size_t size);
 
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* U_HASH_H_ */
+#endif /* CRC32_H_ */
-- 
2.7.4



More information about the mesa-dev mailing list