KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have this double for-loop, where I have both row-order and column-order array indexing, which should be bad for performance. for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { /* Column-major order */ d = array_a[col*height +row]; if (d < 0) { d = 0; } /* Row-major order */ /* Map from x=0,y=0 at buttom left corner to 0,0 at top left corner */ array_b[width*(height-1 -row) + col] = d; } } Is there an approach/method on how to rewrite from one to the other? When I try to rewrite the last to column-order, the data becomes skewed. Can't it be rewritten? Sandra
Tags (comma-separated)
Save Edits
Cancel