Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Msvc fixes #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/constellation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ namespace gr {
uint16_t idx(0);
for(int j=0; j<d_bps; j++){
// sanity check - hopefully this does not slow things down too much
#ifndef _MSC_VER
if(__builtin_expect( in[i*d_bps + j] > 0x01, false)){
throw std::runtime_error((boost::format("ERROR: constellation mapper expects values of 0x00 and 0x01 in *ONLY* - received 0x%02x at bit offset %d!")% ((int)(in[i*d_bps+j]))%(d_bps*i)).str());
}
#endif // !_MSC_VER
idx |= (in[i*d_bps + j] << (d_bps - j-1));
}
out[i] = d_mappings[mapidx][idx];
Expand Down
14 changes: 7 additions & 7 deletions lib/pream_sync_correlator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace gr {
d_in_stream.push_back(gr_complex(0,0));
}
d_in_stream.push_back(gr_complex(0,0));
float phase[N];
__GR_VLA(float, phase, N);
for(int idx = 1; idx < N; idx++){
phase[idx] = arg(d_preamble_symbols[idx]);
}
Expand Down Expand Up @@ -99,13 +99,13 @@ namespace gr {
}

float pream_sync_correlator::acquire_value(void){
float phase[d_preamble_symbol_count];
__GR_VLA(float, phase, d_preamble_symbol_count);
for(int idx=0; idx < d_preamble_symbol_count; idx++){
phase[idx] = arg(d_in_stream[d_preamble_symbol_count - 1 - idx]);
// printf("\t1: sa[%02d] = (%02.4f,%02.4f), phase[%02d] = %02.4f\n",idx,small_array[idx].real(),small_array[idx].imag(),idx,phase[idx]);
}
unwrap(phase, d_preamble_symbol_count);
float phase_change[d_preamble_symbol_count];
__GR_VLA(float, phase_change, d_preamble_symbol_count);
float phase_diff = 0.0;//[d_preamble_symbol_count-1];
phase_change[0] = 0.0;
// phase_diff[idx] = 0.0;
Expand All @@ -132,10 +132,10 @@ namespace gr {
}

void pream_sync_correlator::unwrap(float *phase_array, int N) {
float dp[N];
float dps[N];
float dp_corr[N];
float cumsum[N];
__GR_VLA(float, dp, N);
__GR_VLA(float, dps, N);
__GR_VLA(float, dp_corr, N);
__GR_VLA(float, cumsum, N);
float cutoff = M_PI;
int j;

Expand Down
14 changes: 7 additions & 7 deletions lib/preamble_sync_cc_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace gr {
int search_space = (int) d_preamble.size()/d_interp;
int data_space = d_width/d_interp - search_space;
int payload_space = d_width/d_interp;
float phase[search_space];
__GR_VLA(float, phase, search_space);
if(d_early_term) {
d_corr.reset();
d_state = 0;
Expand Down Expand Up @@ -307,12 +307,12 @@ namespace gr {
}
//for(int ind = 0; ind<d_preamble.size()/d_interp; ind++){ printf("d_preamble_map[%d] = (%f, %f)\n",ind,d_preamble_map[ind].real(),d_preamble_map[ind].imag()); }
d_mapidx = (d_mapidx + d_preamble.size()/d_interp)%d_const.nmaps();
float phase[int(d_preamble.size()/d_interp)];
__GR_VLA(float, phase, int(d_preamble.size() / d_interp));
for(int idx = 0; idx < d_preamble.size()/d_interp; idx++){
phase[idx] = arg(d_preamble_map[idx]);
}
unwrap(phase,(int)d_preamble.size()/d_interp);
float phase_change[d_preamble.size()/d_interp];
__GR_VLA(float, phase_change, d_preamble.size() / d_interp);
phase_change[0] = 0.0;
for(int ind = 1; ind < d_preamble.size()/d_interp; ind++) {
phase_change[ind] = phase[ind] - phase[ind-1];
Expand All @@ -323,10 +323,10 @@ namespace gr {
}

void preamble_sync_cc_impl::unwrap(float *phase_array, int N) {
float dp[N];
float dps[N];
float dp_corr[N];
float cumsum[N];
__GR_VLA(float, dp, N);
__GR_VLA(float, dps, N);
__GR_VLA(float, dp_corr, N);
__GR_VLA(float, cumsum, N);
float cutoff = M_PI;
int j;

Expand Down
6 changes: 3 additions & 3 deletions lib/preamble_sync_demapper_hard_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace gr {
}
//printf("Compare has shifted.\t Pream_len = %d\n",pream_len);
for(int idx=0; idx < MN; idx++){
uint8_t symbol_bits[d_bps];
__GR_VLA(uint8_t, symbol_bits, d_bps);
gr_complex symbol = in[ii] * exp(gr_complex(0,2*M_PI*idx/MN));
d_const.demap_hard(&symbol, &symbol_bits[0], 1);
for(int ind = d_bps; ind > 0; ind--){
Expand All @@ -158,7 +158,7 @@ namespace gr {
}
}
//printf("Compare has updated.\n");
int ham_dist[MN];
__GR_VLA(int, ham_dist, MN);
for(int idx=0; idx < MN; idx++){ ham_dist[idx] = 0; }
for(int idx=0; idx < MN; idx++){
//printf("idx = %d of MN = %d\t",idx,MN);
Expand Down Expand Up @@ -225,7 +225,7 @@ namespace gr {
}
//float soft_out[n_symbols*d_bps];
//d_const.demap_soft(&in_rotated[0], &soft_out[0], n_symbols);
uint8_t hard_out[n_symbols*d_bps];
__GR_VLA(uint8_t, hard_out, n_symbols * d_bps);
d_const.demap_hard(&in_rotated[0], &hard_out[0], n_symbols);
//memcpy(&out[oo], &soft_out[0], sizeof(float)*n_symbols*d_bps);
memcpy(&out[oo], &hard_out[0], sizeof(uint8_t)*n_symbols*d_bps);
Expand Down
6 changes: 3 additions & 3 deletions lib/preamble_sync_demapper_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace gr {
}
//printf("Compare has shifted.\t Pream_len = %d\n",pream_len);
for(int idx=0; idx < MN; idx++){
uint8_t symbol_bits[d_bps];
__GR_VLA(uint8_t, symbol_bits, d_bps);
gr_complex symbol = in[ii] * exp(gr_complex(0,2*M_PI*idx/MN));
d_const.demap_hard(&symbol, &symbol_bits[0], 1);
for(int ind = d_bps; ind > 0; ind--){
Expand All @@ -158,7 +158,7 @@ namespace gr {
}
}
//printf("Compare has updated.\n");
int ham_dist[MN];
__GR_VLA(int, ham_dist, MN);
for(int idx=0; idx < MN; idx++){ ham_dist[idx] = 0; }
for(int idx=0; idx < MN; idx++){
//printf("idx = %d of MN = %d\t",idx,MN);
Expand Down Expand Up @@ -223,7 +223,7 @@ namespace gr {
for(int idx = 0; idx < n_symbols; idx++){
in_rotated[idx] = in[start_pointer+idx] * exp(gr_complex(0,2*M_PI*d_offset/MN));
}
float soft_out[n_symbols*d_bps];
__GR_VLA(float, soft_out, n_symbols * d_bps);
d_const.demap_soft(&in_rotated[0], &soft_out[0], n_symbols);
//uint8_t hard_out[n_symbols*d_bps];
//d_const.demap_hard(&in_rotated[0], &hard_out[0], n_symbols);
Expand Down