Well this is embarrassing.
I tested it yes, but when I tested it I had:
reg_alloc = ((reg_alloc + 7) >> 3) << 3
const int slot = reg_alloc / 8;
Then I remembered that some less friendly compilers
won't like the the declaration being after a statement.
So I pulled it out and changed it to:
const int slot;
reg_alloc = ((reg_alloc + 7) >> 3) << 3
slot = reg_alloc / 8;
And that I did not test.
Just cut off the const keyword and it'll work.
Apologies,
Patrick
Index: register.c
===================================================================
--- register.c (revision 18296)
+++ register.c (working copy)
@@ -338,9 +338,16 @@
size_t reg_alloc = size_nip +
sizeof (STRING*) * n_regs_used[REGNO_STR];
- const int slot = (reg_alloc + 7) >> 3;
- reg_alloc = slot << 3;
+ int slot;
+ /* round reg_alloc up to the nearest multiple of 8 */
+ reg_alloc = ((reg_alloc + 7) >> 3) << 3;
+
+ /* reg_alloc now divides evenly by 8 because of the previous
+ rounding. A granularity of 8 is arbitrary, it could have been
+ some bigger power of 2 */
+ slot = reg_alloc / 8;
+
if (slot >= interp->ctx_mem.n_free_slots) {
const int n = slot + 1;
int i;
On Apr 22, 2007, at 5:55 PM, Leopold Toetsch wrote:
Am Sonntag, 22. April 2007 23:34 schrieb Patrick Rutkowski:
+ const int slot;
+ /* round reg_alloc up to the nearest multiple of 8 */
+ reg_alloc = ((reg_alloc + 7) >> 3) << 3;
+
+ /* reg_alloc now divides evenly by 8 because of the previous
+ rounding. A granualrity of 8 is arbitratly, it could have
been
+ some bigger power of 2 */
+ slot = reg_alloc / 8;
Did you even compile & test this patch?
error: assignment of read-only variable 'slot'
leo