HasherInt.H 2.67 KB
Newer Older
1 2 3 4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
OpenFOAM bot's avatar
OpenFOAM bot committed
5
    \\  /    A nd           | www.openfoam.com
6
     \\/     M anipulation  |
OpenFOAM bot's avatar
OpenFOAM bot committed
7
-------------------------------------------------------------------------------
OpenFOAM bot's avatar
OpenFOAM bot committed
8
    Copyright (C) 2011-2016 OpenFOAM Foundation
9 10 11 12
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

13 14 15 16
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
17 18 19 20 21 22 23

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
24
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
25 26 27 28 29 30 31

InNamespace
    Foam

Description
    Optimized hashing functions.

32
See also
33 34 35 36 37 38 39 40
    Hasher.H

\*---------------------------------------------------------------------------*/

#ifndef HasherInt_H
#define HasherInt_H

#include "Hasher.H"
Henry's avatar
Henry committed
41
#include "int.H"
42 43 44 45 46 47 48 49 50

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    //- An optimized version of Hasher
51 52 53
    //  \param[in] data - an array of uint32_t values
    //  \param[in] length - the number of values (not bytes)
    //  \param[in] seed - the previous hash, or an arbitrary value
54
    unsigned HasherInt(const uint32_t* data, size_t length, unsigned seed = 0);
55 56

    //- An optimized version of Hasher, returning dual hash values
57 58 59
    //  \param[in] data - an array of uint32_t values
    //  \param[in] length - the number of values (not bytes)
    //  \param[in] hash1 - the previous hash, or an arbitrary value
60
    //    on output, the primary hash value
61
    //  \param[in] hash1 - the previous hash, or an arbitrary value
62 63 64
    //    on output, the secondary hash value
    unsigned HasherDual
    (
65 66
        const uint32_t* data,
        size_t length,
67 68 69 70 71 72 73 74 75 76 77 78 79
        unsigned& hash1,
        unsigned& hash2
    );

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //