Skip to content
Snippets Groups Projects
Select Git revision
  • 006b56b5fa7e42209bb6ef84608011097f77e4e2
  • master default protected
  • alphashapes
  • quadMeshingTools
  • cygwin_conv_path
  • macos_arm64
  • add-transfiniteautomatic-to-geo
  • patch_releases_4_10
  • HierarchicalHDiv
  • isuruf-master-patch-63355
  • hyperbolic
  • hexdom
  • hxt_update
  • jf
  • 1618-pythonocc-and-gmsh-api-integration
  • octreeSizeField
  • hexbl
  • alignIrregularVertices
  • getEdges
  • patch_releases_4_8
  • isuruf-master-patch-51992
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
  • gmsh_4_8_4
  • gmsh_4_8_3
  • gmsh_4_8_2
  • gmsh_4_8_1
  • gmsh_4_8_0
  • gmsh_4_7_1
  • gmsh_4_7_0
41 results

GModelIO_NEU.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    Hash.h 1.35 KiB
    #ifndef _HASH_H_
    #define _HASH_H_
    
    //--FNV hashing parameters
    
    #if defined(HAVE_64BIT_SIZE_T)
    #define FNV_PRIME        1099511628211UL
    #define FNV_OFFSET_BASIS 14695981039346656037UL
    #else
    #define FNV_PRIME        16777619UL
    #define FNV_OFFSET_BASIS 2166136261UL
    #endif
    
    //--Hash FNV1a implemented via for loop.  "key" has size "len" bytes.
    
    inline size_t hash_FNV1a(const void *const key, const int len)
    {
      const unsigned char *p = static_cast<const unsigned char*>(key);
      size_t hash = FNV_OFFSET_BASIS;
      for(int n = len; n--; ) hash = (hash^static_cast<size_t>(*p++))*FNV_PRIME;
      return hash;
    }
    
    //--Hash FNV1a implemented via template-metaprogramming loop.  This should be
    //--used if the length N is known at compile time.  "key" has size "N" bytes.
    //--Use the entry point HashFNV1a<N>::eval(key).
    
    template <int N> struct Hash1FNV1a {
      static size_t eval(size_t hash, const unsigned char *p)
      {
        return Hash1FNV1a<N-1>::eval((hash^static_cast<size_t>(*p))*FNV_PRIME, p+1);
      }
    };
    
    template <> struct Hash1FNV1a<1> {
      static size_t eval(size_t hash, const unsigned char *p)
      {
        return (hash^static_cast<size_t>(*p))*FNV_PRIME;
      }
    };
    
    // Entry point
    template <int N> struct HashFNV1a {
      static size_t eval(const void *const key) 
      {
        size_t hash = FNV_OFFSET_BASIS;
        return Hash1FNV1a<N>::eval(hash, static_cast<const unsigned char*>(key));
      }
    };
    
    #endif