diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
commit | df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch) | |
tree | 239ae276b82024b140428e6c0fe5d739fdd686a4 /src/java/com/jogamp/common/util/ValueConv.java | |
parent | eb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/java/com/jogamp/common/util/ValueConv.java')
-rw-r--r-- | src/java/com/jogamp/common/util/ValueConv.java | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/java/com/jogamp/common/util/ValueConv.java b/src/java/com/jogamp/common/util/ValueConv.java index 9a16b64..2ad002a 100644 --- a/src/java/com/jogamp/common/util/ValueConv.java +++ b/src/java/com/jogamp/common/util/ValueConv.java @@ -37,7 +37,7 @@ package com.jogamp.common.util; * </p> */ public class ValueConv { - public static final byte float_to_byte(float v, boolean dSigned) { + public static final byte float_to_byte(final float v, final boolean dSigned) { // lossy if( dSigned ) { return (byte) ( v * ( v > 0 ? 127.0f : 128.0f ) ); @@ -45,14 +45,14 @@ public class ValueConv { return (byte) ( v * 255.0f ); } } - public static final short float_to_short(float v, boolean dSigned) { + public static final short float_to_short(final float v, final boolean dSigned) { if( dSigned ) { return (short) ( v * ( v > 0 ? 32767.0f : 32768.0f ) ); } else { return (short) ( v * 65535.0f ); } } - public static final int float_to_int(float v, boolean dSigned) { + public static final int float_to_int(final float v, final boolean dSigned) { // float significand 0x007fffff // double significand 0x000fffffffffffffL // int min = 0x80000000 = -2147483648 @@ -64,7 +64,7 @@ public class ValueConv { } } - public static final byte double_to_byte(double v, boolean dSigned) { + public static final byte double_to_byte(final double v, final boolean dSigned) { // lossy if( dSigned ) { return (byte) ( v * ( v > 0 ? 127.0 : 128.0 ) ); @@ -72,7 +72,7 @@ public class ValueConv { return (byte) ( v * 255.0 ); } } - public static final short double_to_short(double v, boolean dSigned) { + public static final short double_to_short(final double v, final boolean dSigned) { // lossy if( dSigned ) { return (short) ( v * ( v > 0 ? 32767.0 : 32768.0 ) ); @@ -80,7 +80,7 @@ public class ValueConv { return (short) ( v * 65535.0 ); } } - public static final int double_to_int(double v, boolean dSigned) { + public static final int double_to_int(final double v, final boolean dSigned) { // lossy if( dSigned ) { return (int) ( v * ( v > 0 ? 2147483647.0 : 2147483648.0 ) ); @@ -89,28 +89,28 @@ public class ValueConv { } } - public static final float byte_to_float(byte v, boolean sSigned) { + public static final float byte_to_float(final byte v, final boolean sSigned) { if( sSigned ) { return (v & 0xff) / ( v > 0 ? 127.0f : -128.0f ) ; } else { return (v & 0xff) / 255.0f ; } } - public static final double byte_to_double(byte v, boolean sSigned) { + public static final double byte_to_double(final byte v, final boolean sSigned) { if( sSigned ) { return (v & 0xff) / ( v > 0 ? 127.0 : -128.0 ) ; } else { return (v & 0xff) / 255.0 ; } } - public static final float short_to_float(short v, boolean sSigned) { + public static final float short_to_float(final short v, final boolean sSigned) { if( sSigned ) { return (v & 0xffff) / ( v > 0 ? 32767.0f : -32768.0f ) ; } else { return (v & 0xffff) / 65535.0f ; } } - public static final double short_to_double(short v, boolean sSigned) { + public static final double short_to_double(final short v, final boolean sSigned) { // lossy if( sSigned ) { return (v & 0xffff) / ( v > 0 ? 32767.0 : -32768.0 ) ; @@ -118,7 +118,7 @@ public class ValueConv { return (v & 0xffff) / 65535.0 ; } } - public static final float int_to_float(int v, boolean sSigned) { + public static final float int_to_float(final int v, final boolean sSigned) { // lossy // float significand 0x007fffff // double significand 0x000fffffffffffffL @@ -127,35 +127,35 @@ public class ValueConv { if( sSigned ) { return (float) ( v / ( v > 0 ? 2147483647.0 : 2147483648.0 ) ); } else { - return (float) ( ((long)v & 0xffffffffL) / 4294967295.0 ); + return (float) ( (v & 0xffffffffL) / 4294967295.0 ); } } - public static final double int_to_double(int v, boolean sSigned) { + public static final double int_to_double(final int v, final boolean sSigned) { if( sSigned ) { return v / ( v > 0 ? 2147483647.0 : 2147483648.0 ) ; } else { - return ((long)v & 0xffffffffL) / 4294967295.0 ; + return (v & 0xffffffffL) / 4294967295.0 ; } } - public static final short byte_to_short(byte v, boolean sSigned, boolean dSigned) { + public static final short byte_to_short(final byte v, final boolean sSigned, final boolean dSigned) { return float_to_short(byte_to_float(v, sSigned), dSigned); } - public static final int byte_to_int(byte v, boolean sSigned, boolean dSigned) { + public static final int byte_to_int(final byte v, final boolean sSigned, final boolean dSigned) { return float_to_int(byte_to_float(v, sSigned), dSigned); } - public static final byte short_to_byte(short v, boolean sSigned, boolean dSigned) { + public static final byte short_to_byte(final short v, final boolean sSigned, final boolean dSigned) { return float_to_byte(short_to_float(v, sSigned), dSigned); } - public static final int short_to_int(short v, boolean sSigned, boolean dSigned) { + public static final int short_to_int(final short v, final boolean sSigned, final boolean dSigned) { return float_to_int(short_to_float(v, sSigned), dSigned); } - public static final byte int_to_byte(int v, boolean sSigned, boolean dSigned) { + public static final byte int_to_byte(final int v, final boolean sSigned, final boolean dSigned) { return float_to_byte(int_to_float(v, sSigned), dSigned); } - public static final short int_to_short(int v, boolean sSigned, boolean dSigned) { + public static final short int_to_short(final int v, final boolean sSigned, final boolean dSigned) { return float_to_short(int_to_float(v, sSigned), dSigned); } } |