TDE base libraries and programs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
389 B

  1. #ifndef BGHASH_H
  2. #define BGHASH_H
  3. /*
  4. * TQString -> int hash. From Qt's TQGDict::hashKeyString().
  5. */
  6. static int TQHash(TQString key)
  7. {
  8. int g, h = 0;
  9. const TQChar *p = key.unicode();
  10. for (unsigned i=0; i < key.length(); i++) {
  11. h = (h << 4) + p[i].cell();
  12. if ((g = (h & 0xf0000000)))
  13. h ^= (g >> 24);
  14. h &= ~g;
  15. }
  16. return h;
  17. }
  18. #endif