Index: mppenc/branches/r2d/libmpcenc/quant.c
===================================================================
--- mppenc/branches/r2d/libmpcenc/quant.c	(revision 72)
+++ mppenc/branches/r2d/libmpcenc/quant.c	(revision 73)
@@ -161,13 +161,9 @@
     float  tmp ;
     float  tmp2;
-    float  tmp3;
 
     // Summation of the absolute power and the quadratic error
     for ( k = 0; k < 36; k++ ) {
         tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
+		tmp  = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2;
 
         Fehler += tmp * tmp;
@@ -191,5 +187,4 @@
     float  tmp ;
     float  tmp2;
-    float  tmp3;
 
     // Summation of the absolute power and the quadratic error
@@ -198,8 +193,5 @@
     for ( ; k < 12; k++ ) {
         tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
+		tmp  = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2;
 
         Fehler += tmp * tmp;
@@ -211,8 +203,5 @@
     for ( ; k < 24; k++ ) {
         tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
+		tmp  = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2;
 
         Fehler += tmp * tmp;
@@ -225,8 +214,5 @@
     for ( ; k < 36; k++ ) {
         tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
+		tmp  = __builtin_nearbyintf(tmp2 * fac) * invfac - tmp2;
 
         Fehler += tmp * tmp;
@@ -250,12 +236,9 @@
     float  mult    = A [res] * NoiseInjectionCompensation1D [res];
     float  invmult = C [res];
-    float  tmp;
     int    quant;
     float  signal;
 
 	for ( n = 0; n < 36 - maxNsOrder; n++, input++, qu_output++ ) {
-        // q = ftol(in), correct rounding
-        tmp   = *input * mult + 0xFF8000;
-        quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
+		quant = (unsigned int)(__builtin_lrintf(*input * mult) + offset);
 
         // limitation to 0...2D
@@ -268,8 +251,6 @@
 
     for ( ; n < 36; n++, input++, qu_output++ ) {
-        // q = ftol(in), correct rounding
         signal = *input * mult;
-        tmp   =  signal + 0xFF8000;
-        quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
+		quant = (unsigned int)(__builtin_lrintf(signal) + offset);
 
         // calculate the current error and save it for error refeeding
@@ -293,5 +274,4 @@
 
     float  signal;
-    float  tmp;
     float  mult    = A [res];
     float  invmult = C [res];
@@ -304,8 +284,5 @@
     for ( n = 0; n < 36; n++, input++, qu_output++ ) {
         signal = *input * NoiseInjectionCompensation1D [res] - (FIR[5]*errors[n+0] + FIR[4]*errors[n+1] + FIR[3]*errors[n+2] + FIR[2]*errors[n+3] + FIR[1]*errors[n+4] + FIR[0]*errors[n+5]);
-
-        // quant = ftol(signal), correct rounding
-        tmp   = signal * mult + 0xFF8000;
-        quant = *(int*) & tmp - 0x4B7F8000;
+		quant = __builtin_lrintf(signal * mult);
 
         // calculate the current error and save it for error refeeding
Index: mppenc/branches/r2d/mppenc.kdevelop
===================================================================
--- mppenc/branches/r2d/mppenc.kdevelop	(revision 72)
+++ mppenc/branches/r2d/mppenc.kdevelop	(revision 73)
@@ -19,5 +19,5 @@
     <general>
       <activetarget>src/mppenc</activetarget>
-      <useconfiguration>debug</useconfiguration>
+      <useconfiguration>optimized</useconfiguration>
     </general>
     <run>
@@ -39,5 +39,5 @@
         <cxxcompiler>kdevgppoptions</cxxcompiler>
         <f77compiler>kdevg77options</f77compiler>
-        <cflags>-O3 -fomit-frame-pointer -pipe -g0 -Wall</cflags>
+        <cflags>-O3 -fomit-frame-pointer -pipe -Wall -ffast-math</cflags>
         <envvars/>
         <configargs></configargs>
@@ -59,12 +59,12 @@
         <cflags>-O0 -Wall -g3</cflags>
         <envvars/>
-        <topsourcedir></topsourcedir>
-        <cppflags></cppflags>
-        <ldflags></ldflags>
-        <ccompilerbinary></ccompilerbinary>
-        <cxxcompilerbinary></cxxcompilerbinary>
-        <f77compilerbinary></f77compilerbinary>
-        <cxxflags></cxxflags>
-        <f77flags></f77flags>
+        <topsourcedir/>
+        <cppflags/>
+        <ldflags/>
+        <ccompilerbinary/>
+        <cxxcompilerbinary/>
+        <f77compilerbinary/>
+        <cxxflags/>
+        <f77flags/>
       </debug>
     </configurations>
