Search:

Type: Posts; User: Nominal Animal

Search: Search took 0.03 seconds.

  1. Absolutely. I only wanted you to know the code...

    Absolutely. I only wanted you to know the code does exist, and runs with the timings I said in my post, using WinMIPS64. (As you probably know, I prefer to explain or show the basis of my claims,...
  2. There is a formula for it, but I didn't bother...

    There is a formula for it, but I didn't bother rediscovering it or looking it up: I just checked it in a loop (comparing data/1000 to the value obtained using the multiply by reciprocal method) and...
  3. I just wrote and checked the code I described...

    I just wrote and checked the code I described above in #12. It runs with just one "branch taken stall" per iteration, no other stalls (in particular, zero RAW stalls), and runs in about 17 × values +...
  4. It's the reciprocal of 1000 using 31-bit...

    It's the reciprocal of 1000 using 31-bit integers:

    231 / 1000 = 2147483648 / 1000 = 2147483.648 ≃ 2147484

    The value is rounded up, because that gives the correct integer result in a larger...
  5. Well, instead of multiplying by the reciprocal,...

    Well, instead of multiplying by the reciprocal, you can use slt or slti to evaluate


    counter_offset = ( 5 - (value < 5000) ? 1 : 0) - (value < 4000) ? 1 : 0) - (value < 3000) ? 1 : 0) - (value <...
  6. Oh! It's the Windows 64-bit MIPS simulator! I...

    Oh! It's the Windows 64-bit MIPS simulator! I kind-of assumed you used a real-world 32-bit microcontroller. First, let me explain what my example code does, and why:

    When a value is negative, the...
  7. I'm on roughly the same path with Salem's first...

    I'm on roughly the same path with Salem's first suggestion, but I'd go a lot further.

    Because the divisor is a constant, you don't need real division; you can multiply by the reciprocal instead.
    ...
Results 1 to 7 of 7