<commit_before>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/djb2.h"

uint32 DJB2Hash(const void* buf, size_t len, uint32 hash) {
  const uint8* s = reinterpret_cast<const uint8*>(buf);
  if (len > 0) {
    do {
      hash = hash * 33 + *s++;
    } while (--len);
  }
  return hash;
}
<commit_msg>hash code cleanup - copy seed to local and use array indexing.  1.483 ms for 720p vs 2.225 ms for old code. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10052036<commit_after>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/djb2.h"

uint32 DJB2Hash(const void* buf, size_t len, uint32 seed) {
  const uint8* src = reinterpret_cast<const uint8*>(buf);
  uint32 hash = seed;
  for (size_t i = 0; i < len; ++i) {
    hash = hash * 33 + src[i];
  }
  return hash;
}
{'fraction_non_alphanumeric': 0.11682242990654206, 'fraction_numerical': 0.04766355140186916, 'mean_word_length': 3.3360323886639676, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3782161', 'n_tokens_mistral': 400, 'n_tokens_neox': 360, 'n_words': 141}