~ubuntu-branches/ubuntu/precise/lightning-extension/precise-security

« back to all changes in this revision

Viewing changes to mozilla/mfbt/HashFunctions.h

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-09-03 14:00:01 UTC
  • mfrom: (1.3.6)
  • Revision ID: package-import@ubuntu.com-20120903140001-319alazkdaxkicwi
Tags: 1.8+build1-0ubuntu0.12.04.1
* New upstream stable release to support Thunderbird 16 (CALENDAR_1_8_BUILD1)
  - LP: #1062587

* Add extra Makefiles that are needed for the build
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
 
 * vim: set ts=8 sw=4 et tw=99 ft=cpp:
3
 
 *
4
 
 * This Source Code Form is subject to the terms of the Mozilla Public
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* This Source Code Form is subject to the terms of the Mozilla Public
5
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6
4
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7
5
 
8
 
/* Utilities for hashing */
 
6
/* Utilities for hashing. */
9
7
 
10
8
/*
11
9
 * This file exports functions for hashing data down to a 32-bit value,
26
24
 *
27
25
 * You can chain these functions together to hash complex objects.  For example:
28
26
 *
29
 
 *  class ComplexObject {
30
 
 *    char* str;
31
 
 *    uint32_t uint1, uint2;
32
 
 *    void (*callbackFn)();
 
27
 *  class ComplexObject
 
28
 *  {
 
29
 *      char* str;
 
30
 *      uint32_t uint1, uint2;
 
31
 *      void (*callbackFn)();
33
32
 *
34
 
 *    uint32_t Hash() {
35
 
 *      uint32_t hash = HashString(str);
36
 
 *      hash = AddToHash(hash, uint1, uint2);
37
 
 *      return AddToHash(hash, callbackFn);
38
 
 *    }
 
33
 *    public:
 
34
 *      uint32_t hash() {
 
35
 *        uint32_t hash = HashString(str);
 
36
 *        hash = AddToHash(hash, uint1, uint2);
 
37
 *        return AddToHash(hash, callbackFn);
 
38
 *      }
39
39
 *  };
40
40
 *
41
41
 * If you want to hash an nsAString or nsACString, use the HashString functions
48
48
#include "mozilla/Assertions.h"
49
49
#include "mozilla/Attributes.h"
50
50
#include "mozilla/StandardInteger.h"
 
51
#include "mozilla/Types.h"
51
52
 
52
53
#ifdef __cplusplus
53
54
namespace mozilla {