-
Notifications
You must be signed in to change notification settings - Fork 6
/
Verifier.cs
53 lines (46 loc) · 1.38 KB
/
Verifier.cs
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
/*
* Created by SharpDevelop.
* User: Administrator
* Date: 2006-12-16
* Time: 1:05
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace NChardet
{
/// <summary>
/// Description of Verifier.
/// </summary>
public abstract class Verifier
{
internal static readonly byte eStart = (byte)0;
internal static readonly byte eError = (byte)1;
internal static readonly byte eItsMe = (byte)2;
internal static readonly int eidxSft4bits = 3;
internal static readonly int eSftMsk4bits = 7;
internal static readonly int eBitSft4bits = 2;
internal static readonly int eUnitMsk4bits = 0x0000000F;
public Verifier()
{
}
public abstract string charset();
public abstract int stFactor();
public abstract int[] cclass();
public abstract int[] states();
public abstract bool isUCS2();
public static byte getNextState(Verifier v, byte b, byte s) {
return (byte) ( 0xFF &
(((v.states()[((
(s*v.stFactor()+(((v.cclass()[((b&0xFF)>>eidxSft4bits)])
>> ((b & eSftMsk4bits) << eBitSft4bits))
& eUnitMsk4bits ))&0xFF)
>> eidxSft4bits) ]) >> (((
(s*v.stFactor()+(((v.cclass()[((b&0xFF)>>eidxSft4bits)])
>> ((b & eSftMsk4bits) << eBitSft4bits))
& eUnitMsk4bits ))&0xFF)
& eSftMsk4bits) << eBitSft4bits)) & eUnitMsk4bits )
) ;
}
}
}