     }
 
     float chosen_bin = xcoord[maxbin[0]];
-    // if( chosen_bin >= ORI_NBINS ) chosen_bin -= ORI_NBINS;
-    chosen_bin -= ( chosen_bin >= ORI_NBINS ? float(ORI_NBINS) : 0.0f );
+    if( chosen_bin >= ORI_NBINS ) chosen_bin -= ORI_NBINS;
+
     float th = __fdividef(M_PI2 * chosen_bin , ORI_NBINS) - M_PI;
 
     ext->orientation = th;


    #pragma unroll
    for( int i=0; i<ORIENTATION_MAX_COUNT; i++ ) {
        maxbin[i] = 0;
        y_max[i] = -INFINITY;
    }


#include <inttypes.h>

using namespace popart;
using namespace std;

// Lowe wants at most 3 orientations at every extremum,
// VLFeat uses at most 4, OpenCV all it can find
