37 public static final byte float_to_byte(
final float v,
final boolean dSigned) {
40 return (
byte) ( v * ( v > 0 ? 127.0f : 128.0f ) );
42 return (
byte) ( v * 255.0f );
45 public static final short float_to_short(
final float v,
final boolean dSigned) {
47 return (
short) ( v * ( v > 0 ? 32767.0f : 32768.0f ) );
49 return (
short) ( v * 65535.0f );
52 public static final int float_to_int(
final float v,
final boolean dSigned) {
58 return (
int) ( v * ( v > 0 ? 2147483647.0 : 2147483648.0 ) );
60 return (
int) (long) ( v * 4294967295.0 );
64 public static final byte double_to_byte(
final double v,
final boolean dSigned) {
67 return (
byte) ( v * ( v > 0 ? 127.0 : 128.0 ) );
69 return (
byte) ( v * 255.0 );
72 public static final short double_to_short(
final double v,
final boolean dSigned) {
75 return (
short) ( v * ( v > 0 ? 32767.0 : 32768.0 ) );
77 return (
short) ( v * 65535.0 );
80 public static final int double_to_int(
final double v,
final boolean dSigned) {
83 return (
int) ( v * ( v > 0 ? 2147483647.0 : 2147483648.0 ) );
85 return (
int) (long) ( v * 4294967295.0 );
89 public static final float byte_to_float(
final byte v,
final boolean sSigned) {
91 return (v & 0xff) / ( v > 0 ? 127.0f : -128.0f ) ;
93 return (v & 0xff) / 255.0f ;
96 public static final double byte_to_double(
final byte v,
final boolean sSigned) {
98 return (v & 0xff) / ( v > 0 ? 127.0 : -128.0 ) ;
100 return (v & 0xff) / 255.0 ;
105 return (v & 0xffff) / ( v > 0 ? 32767.0f : -32768.0f ) ;
107 return (v & 0xffff) / 65535.0f ;
113 return (v & 0xffff) / ( v > 0 ? 32767.0 : -32768.0 ) ;
115 return (v & 0xffff) / 65535.0 ;
118 public static final float int_to_float(
final int v,
final boolean sSigned) {
125 return (
float) ( v / ( v > 0 ? 2147483647.0 : 2147483648.0 ) );
127 return (
float) ( (v & 0xffffffffL) / 4294967295.0 );
130 public static final double int_to_double(
final int v,
final boolean sSigned) {
132 return v / ( v > 0 ? 2147483647.0 : 2147483648.0 ) ;
134 return (v & 0xffffffffL) / 4294967295.0 ;
138 public static final short byte_to_short(
final byte v,
final boolean sSigned,
final boolean dSigned) {
141 public static final int byte_to_int(
final byte v,
final boolean sSigned,
final boolean dSigned) {
145 public static final byte short_to_byte(
final short v,
final boolean sSigned,
final boolean dSigned) {
148 public static final int short_to_int(
final short v,
final boolean sSigned,
final boolean dSigned) {
152 public static final byte int_to_byte(
final int v,
final boolean sSigned,
final boolean dSigned) {
155 public static final short int_to_short(
final int v,
final boolean sSigned,
final boolean dSigned) {
Utility class providing simple signed and unsigned primitive value conversions for byte,...
static final byte short_to_byte(final short v, final boolean sSigned, final boolean dSigned)
static final byte int_to_byte(final int v, final boolean sSigned, final boolean dSigned)
static final float short_to_float(final short v, final boolean sSigned)
static final short byte_to_short(final byte v, final boolean sSigned, final boolean dSigned)
static final int double_to_int(final double v, final boolean dSigned)
static final short float_to_short(final float v, final boolean dSigned)
static final int float_to_int(final float v, final boolean dSigned)
static final double int_to_double(final int v, final boolean sSigned)
static final byte float_to_byte(final float v, final boolean dSigned)
static final int short_to_int(final short v, final boolean sSigned, final boolean dSigned)
static final float byte_to_float(final byte v, final boolean sSigned)
static final short int_to_short(final int v, final boolean sSigned, final boolean dSigned)
static final short double_to_short(final double v, final boolean dSigned)
static final double short_to_double(final short v, final boolean sSigned)
static final byte double_to_byte(final double v, final boolean dSigned)
static final int byte_to_int(final byte v, final boolean sSigned, final boolean dSigned)
static final double byte_to_double(final byte v, final boolean sSigned)
static final float int_to_float(final int v, final boolean sSigned)