private static float[] LoadNormTable() // LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006) { float[] normTable = new float[256]; for (int i = 0; i < 256; i++) { float floatNorm = SmallSingle.SByte315ToSingle((sbyte)i); normTable[i] = 1.0f / (floatNorm * floatNorm); } return(normTable); }
/// <summary> /// Encodes the length to a byte via <see cref="SmallSingle"/>. </summary> protected internal virtual byte EncodeNormValue(float boost, float length) { return(SmallSingle.SingleToByte315((boost / (float)Math.Sqrt(length)))); }