Mega Code Archive

 
Categories / Android / Date Type
 

Convert a float to 16 16 fixed-point representation

//package edu.dhbw.andobjviewer.util; // Much of this is adapted from the beartronics FP lib  class FixedPointUtils {   public static final int ONE = 0x10000;      /**    * Convert a float to  16.16 fixed-point representation    * @param val The value to convert    * @return The resulting fixed-point representation    */   public static int toFixed(float val) {     return (int)(val * 65536F);   } }