Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
65 lines (57 loc) · 2.05 KB

File metadata and controls

65 lines (57 loc) · 2.05 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
/*
* IMPORTANT:
* This file does not compile stand alone. It was required so that
* the same code could be built into a utility program comphash.exe as well
* as the scripting dll's. This file is included in core\comphash.cpp
* to be used by comphash.exe. It is included in core\scrutil.cpp where to
* be used by jscript.dll and vbscript.dll.
*
* comphash.exe is a utility used in the build to generate a source code file
* containing a table of hash values associated with strings needed by
* jscript and vbscript. It is highly desirable to have a single definition
* of the hash function so things don't go out of sync.
*/
ULONG CaseSensitiveComputeHashCch(LPCOLESTR prgch, int32 cch)
{
ULONG luHash = 0;
while (cch-- > 0)
luHash = 17 * luHash + *(char16 *)prgch++;
return luHash;
}
ULONG CaseSensitiveComputeHashCch(LPCUTF8 prgch, int32 cch)
{
utf8::DecodeOptions options = utf8::doAllowThreeByteSurrogates;
ULONG luHash = 0;
while (cch-- > 0)
{
LPCUTF8 end = prgch + cch + 1; // WARNING: Assume cch correct, suppress end-of-buffer checking
luHash = 17 * luHash + utf8::Decode(prgch, end, options);
}
return luHash;
}
ULONG CaseSensitiveComputeHashCch(char const * prgch, int32 cch)
{
ULONG luHash = 0;
while (cch-- > 0)
{
Assert(utf8::IsStartByte(*prgch) && !utf8::IsLeadByte(*prgch));
luHash = 17 * luHash + *prgch++;
}
return luHash;
}
ULONG CaseInsensitiveComputeHash(LPCOLESTR posz)
{
ULONG luHash = 0;
char16 ch;
while (0 != (ch = *(char16 *)posz++))
{
if (ch <= 'Z' && ch >= 'A')
ch += 'a' - 'A';
luHash = 17 * luHash + ch;
}
return luHash;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.