ClassLibraryWeiBao/QR二维码/ReedSolomon/GaloisField256.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;

namespace Gma.QrCodeNet.Encoding.ReedSolomon
{
	/// <summary>
	/// Description of GaloisField256.
	/// </summary>
	internal sealed class GaloisField256
	{
		private int[] antiLogTable;
		private int[] logTable;
		
		private readonly int m_primitive;
		
		internal int Primitive
		{
			get
			{
				return m_primitive;
			}
		}
		
		
		internal GaloisField256(int primitive)
		{
			antiLogTable = new int[256];
			logTable = new int[256];
			
			m_primitive = primitive;
			
			int gfx = 1;
			//Power cycle is from 0 to 254. 2^255 = 1 = 2^0 
			//Value cycle is from 1 to 255. Thus there should not have Log(0).			
			for(int powers = 0; powers < 256; powers++)
			{
				antiLogTable[powers] = gfx;
				if(powers != 255)
					logTable[gfx] = powers;
				gfx <<= 1;		//gfx = gfx * 2 where alpha is 2.
				
				if(gfx > 255)
				{
					gfx ^= primitive;
				}
			}
		}
		
		internal static GaloisField256 QRCodeGaloisField
		{
			get
			{
				return new GaloisField256(QRCodeConstantVariable.QRCodePrimitive);
			}
		}
		
		/// <returns>
		/// Powers of a in GF table. Where a = 2
		/// </returns>
		internal int Exponent(int PowersOfa)
		{
后面还有 70 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。