Exemplo n.º 1
0
		public static float InverseSqrtFast(float x)
		{
			BufferItem item = new BufferItem();
			item.Single = x;

			float xhalf = 0.5f * item.Single;
			int i = item.Int32; // Read bits as integer.
			item.Int32 = 0x5f375a86 - (i >> 1); // Make an initial guess for Newton-Raphson approximation
			return item.Single * (1.5f - xhalf * item.Single * item.Single); // Perform left single Newton-Raphson step.
		}
Exemplo n.º 2
0
		/// <summary>
		/// Indicates whether this instance and a specified object are equal.
		/// </summary>
		public bool Equals(BufferItem other)
		{
			return this.Int32 == other.Int32;
		}