Browse Source

ImHash: defaults seed to zero + comment.

ocornut 10 years ago
parent
commit
4ac4d1ac37
2 changed files with 3 additions and 3 deletions
  1. 2 2
      imgui.cpp
  2. 1 1
      imgui_internal.h

+ 2 - 2
imgui.cpp

@@ -816,9 +816,9 @@ int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args)
     return (w == -1) ? buf_size : w;
 }
 
-// Pass data_size==0 for zero-terminated string
+// Pass data_size==0 for zero-terminated strings
 // FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
-ImU32 ImHash(const void* data, int data_size, ImU32 seed = 0) 
+ImU32 ImHash(const void* data, int data_size, ImU32) 
 { 
     static ImU32 crc32_lut[256] = { 0 };
     if (!crc32_lut[1])

+ 1 - 1
imgui_internal.h

@@ -81,7 +81,7 @@ int                 ImTextCountCharsFromUtf8(const char* in_text, const char* in
 int                 ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end);                   // return number of bytes to express string as UTF-8 code-points
 
 // Helpers: Misc
-ImU32               ImHash(const void* data, int data_size, ImU32 seed);
+ImU32               ImHash(const void* data, int data_size, ImU32 seed = 0);	// Pass data_size==0 for zero-terminated strings
 bool                ImLoadFileToMemory(const char* filename, const char* file_open_mode, void** out_file_data, int* out_file_size = NULL, int padding_bytes = 0);
 bool                ImIsPointInTriangle(const ImVec2& p, const ImVec2& a, const ImVec2& b, const ImVec2& c);
 static inline bool  ImCharIsSpace(int c)            { return c == ' ' || c == '\t' || c == 0x3000; }