require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_RF__RF_HIST_H_)) {
    eval 'sub _RF__RF_HIST_H_ () {1;}' unless defined(&_RF__RF_HIST_H_);
    require 'rf_types.ph';
    eval 'sub RF_HIST_RESOLUTION () {5;}' unless defined(&RF_HIST_RESOLUTION);
    eval 'sub RF_HIST_MIN_VAL () {0;}' unless defined(&RF_HIST_MIN_VAL);
    eval 'sub RF_HIST_MAX_VAL () {1000;}' unless defined(&RF_HIST_MAX_VAL);
    eval 'sub RF_HIST_RANGE () {( &RF_HIST_MAX_VAL -  &RF_HIST_MIN_VAL);}' unless defined(&RF_HIST_RANGE);
    eval 'sub RF_HIST_NUM_BUCKETS () {( &RF_HIST_RANGE /  &RF_HIST_RESOLUTION + 1);}' unless defined(&RF_HIST_NUM_BUCKETS);
    eval 'sub RF_HIST_ADD {
        my($_hist_,$_val_) = @_;
	    eval q( &do {  &RF_Hist_t  &val;  &val = (( &RF_Hist_t)($_val_)) / 1000;  &if ( &val >=  &RF_HIST_MAX_VAL) $_hist_->[ &RF_HIST_NUM_BUCKETS-1]++;  &else $_hist_->[( &val -  &RF_HIST_MIN_VAL) /  &RF_HIST_RESOLUTION]++; }  &while (0));
    }' unless defined(&RF_HIST_ADD);
}
1;
