Переглянути джерело

Add starpu_hash_crc32c_be_ptr

Samuel Thibault 4 роки тому
батько
коміт
d47722e03a
2 змінених файлів з 13 додано та 0 видалено
  1. 8 0
      include/starpu_hash.h
  2. 5 0
      src/common/hash.c

+ 8 - 0
include/starpu_hash.h

@@ -39,6 +39,14 @@ extern "C"
 uint32_t starpu_hash_crc32c_be_n(const void *input, size_t n, uint32_t inputcrc);
 
 /**
+   Compute the CRC of a pointer value seeded by the \p inputcrc
+   <em>current state</em>. The return value should be considered as the new
+   <em>current state</em> for future CRC computation. This is used for computing
+   data size footprint.
+*/
+uint32_t starpu_hash_crc32c_be_ptr(uintptr_t input, uint32_t inputcrc);
+
+/**
    Compute the CRC of a 32bit number seeded by the \p inputcrc
    <em>current state</em>. The return value should be considered as the new
    <em>current state</em> for future CRC computation. This is used for computing

+ 5 - 0
src/common/hash.c

@@ -46,6 +46,11 @@ uint32_t starpu_hash_crc32c_be_n(const void *input, size_t n, uint32_t inputcrc)
 	return crc;
 }
 
+uint32_t starpu_hash_crc32c_be_ptr(uintptr_t input, uint32_t inputcrc)
+{
+	return starpu_hash_crc32c_be_n(&input, sizeof(input), inputcrc);
+}
+
 uint32_t starpu_hash_crc32c_be(uint32_t input, uint32_t inputcrc)
 {
 	uint8_t *p = (uint8_t *)&input;