Commit b4fd140d authored by Davis King's avatar Davis King

Added some casts and a few other minor changes to get the code compiling

in gcc 4.1.1.
parent 46c02483
......@@ -346,8 +346,8 @@ namespace dlib
}
else // if we should do some interpolation
{
unsigned long quantized_angle_lower = std::floor(angle);
unsigned long quantized_angle_upper = std::ceil(angle);
unsigned long quantized_angle_lower = static_cast<unsigned long>(std::floor(angle));
unsigned long quantized_angle_upper = static_cast<unsigned long>(std::ceil(angle));
quantized_angle_lower %= num_orientation_bins;
quantized_angle_upper %= num_orientation_bins;
......
......@@ -34,8 +34,8 @@ namespace dlib
*/
using namespace std;
const int height = std::floor(std::sqrt(area/width_to_height_ratio) + 0.5);
const int width = std::floor(area/height + 0.5);
const int height = (int)std::floor(std::sqrt(area/width_to_height_ratio) + 0.5);
const int width = (int)std::floor(area/height + 0.5);
return centered_rect(0,0,width,height);
}
......
......@@ -67,12 +67,12 @@ namespace dlib
COMPILE_TIME_ASSERT(num_states > 0);
DLIB_ASSERT(std::pow(num_states,order) < std::numeric_limits<unsigned long>::max(),
DLIB_ASSERT(std::pow(num_states,(double)order) < std::numeric_limits<unsigned long>::max(),
"\t void find_max_factor_graph_viterbi()"
<< "\n\t The order is way too large for this algorithm to handle."
<< "\n\t order: " << order
<< "\n\t num_states: " << num_states
<< "\n\t std::pow(num_states,order): " << std::pow(num_states,order)
<< "\n\t std::pow(num_states,order): " << std::pow(num_states,(double)order)
<< "\n\t std::numeric_limits<unsigned long>::max(): " << std::numeric_limits<unsigned long>::max()
);
......@@ -106,7 +106,7 @@ namespace dlib
}
const unsigned long trellis_size = static_cast<unsigned long>(std::pow(num_states,order));
const unsigned long trellis_size = static_cast<unsigned long>(std::pow(num_states,(double)order));
unsigned long init_ring_size = 1;
array2d<impl::viterbi_data> trellis;
......
......@@ -36,7 +36,7 @@ namespace
map_problem()
{
data = randm(number_of_nodes(),std::pow(num_states,order+1), rnd);
data = randm(number_of_nodes(),(long)std::pow(num_states,(double)order+1), rnd);
}
unsigned long number_of_nodes (
......
......@@ -9,11 +9,11 @@
#include "tester.h"
#include <dlib/pixel.h>
#include <dlib/svm_threaded.h>
#include <dlib/gui_widgets.h>
#include <dlib/array.h>
#include <dlib/array2d.h>
#include <dlib/image_keypoint.h>
#include <dlib/image_processing.h>
#include <dlib/image_transforms.h>
namespace
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment