Search found 92 matches
- Wed Jul 26, 2017 8:21 am
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 25002
Re: Faster x mod 384 (x%384)?
To simplify the explanation I imply the operation is with (16bit) integers. But instead is with 16:16 fixed points. So really the operation is something like:
x mod 384<<16 where x can range from 0 to 4096<<16. (Meaning it uses signed 32 bit integers)
As I understand, integer part of your 16.16 ...
- Tue Jul 25, 2017 9:21 am
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 25002
Re: Faster x mod 384 (x%384)?
Great formula.
a = 56959
d1 = 21
d2 = 17
# d1 and d2 are random divisors
a % (d1*d2) == a // d1 % d2 * d1 + a % d1
a % 320 == a // 64 % 5 * 64 + a % 64
a % 320 == (((a >> 6) % 5) << 6) + (a & 0x3F)
r57shell, there's no need in "|" in next line, just use "+".
| (a & 0x3F);
a = 56959
d1 = 21
d2 = 17
# d1 and d2 are random divisors
a % (d1*d2) == a // d1 % d2 * d1 + a % d1
a % 320 == a // 64 % 5 * 64 + a % 64
a % 320 == (((a >> 6) % 5) << 6) + (a & 0x3F)
r57shell, there's no need in "|" in next line, just use "+".
| (a & 0x3F);
- Mon Jul 24, 2017 9:02 pm
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 25002
Re: Faster x mod 384 (x%384)?
All code below is in Python
A key formula is the "general rule" in the article you linked earlier
Example:
a = 123
m = 5
b = 16
# equal results
print( a % m )
print( ( (b % m) * (a // b) + (a % b) ) % m )
To find residue of dividing by 320 you can find residues of 5 and 64 and then convert them ...
A key formula is the "general rule" in the article you linked earlier
Example:
a = 123
m = 5
b = 16
# equal results
print( a % m )
print( ( (b % m) * (a // b) + (a % b) ) % m )
To find residue of dividing by 320 you can find residues of 5 and 64 and then convert them ...
- Mon Jul 24, 2017 7:21 pm
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 25002
Re: Faster x mod 384 (x%384)?
Miquel, this C-written mod3 function has about 20 arithmetic operations. I'm afraid, in terms of M68k they will consume more cycles in total than one DIVU :D
Fast version will require pre-computed array.
Straightforward method is (don't be confused with different meaning of 'x'):
x mod 320 = x - x ...
Fast version will require pre-computed array.
Straightforward method is (don't be confused with different meaning of 'x'):
x mod 320 = x - x ...
- Wed Apr 19, 2017 8:22 pm
- Forum: Megadrive/Genesis
- Topic: 68000 programming optimization tips? (for speed)
- Replies: 28
- Views: 48786
Re: 68000 programming optimization tips? (for speed)
By the way, a lot of people ignore Scc commands (ST, SF, Sxx), but they are pretty useful to calculate complex boolean expressions (with addition of NOT, AND, OR, EOR) rather than doing a massive branching.
- Tue Apr 18, 2017 7:27 pm
- Forum: Megadrive/Genesis
- Topic: 68000 programming optimization tips? (for speed)
- Replies: 28
- Views: 48786
Re: 68000 programming optimization tips? (for speed)
You say you know basic optimization techniques. In most cases "advanced" optimization tricks will be a compromise between performance and code size or, which is worse, between performance and code complexity and readability. I think it will be better to give us some samples you want to optimize ...
- Sat Aug 13, 2016 10:48 am
- Forum: Sound
- Topic: New Documentation: An authoritative reference on the YM2612
- Replies: 865
- Views: 2737829
Re: New Documentation: An authoritative reference on the YM2612
Hi all!
I haven't read this topic for many years. Maybe, this info was discussed earlier, maybe I'm repeating myself, if so, pardon me.
The subject is "ladder effect". Eke gave link to my old post about DAC output, where I say
operators are shifted arithmetically (not logically) by 5 bits
Ladder ...
I haven't read this topic for many years. Maybe, this info was discussed earlier, maybe I'm repeating myself, if so, pardon me.
The subject is "ladder effect". Eke gave link to my old post about DAC output, where I say
operators are shifted arithmetically (not logically) by 5 bits
Ladder ...
- Wed Mar 05, 2014 12:55 pm
- Forum: Sound
- Topic: Extreme High Quality Sound Emulation
- Replies: 24
- Views: 28218
Блин, два грамотея ведут диалог на ломаном английском на импортном форуме.
Ты уверен, что знаешь, что вызывает зеркалирование? Я тебе говорю, это выходит при расчёте матрицы ДПФ над вещественными числами. Эту хрень ты и видишь на картинках и слышишь в ушах. Возьми посчитай ДПФ руками, чтобы понять ...
Ты уверен, что знаешь, что вызывает зеркалирование? Я тебе говорю, это выходит при расчёте матрицы ДПФ над вещественными числами. Эту хрень ты и видишь на картинках и слышишь в ушах. Возьми посчитай ДПФ руками, чтобы понять ...
- Tue Mar 04, 2014 8:38 pm
- Forum: Sound
- Topic: Extreme High Quality Sound Emulation
- Replies: 24
- Views: 28218
- Tue Mar 04, 2014 7:40 pm
- Forum: Sound
- Topic: Extreme High Quality Sound Emulation
- Replies: 24
- Views: 28218
- Thu Jul 11, 2013 10:19 am
- Forum: Blabla
- Topic: 64206 riddle...
- Replies: 5
- Views: 7122
- Wed Jul 10, 2013 1:22 pm
- Forum: Blabla
- Topic: 64206 riddle...
- Replies: 5
- Views: 7122
- Fri Jun 28, 2013 10:28 am
- Forum: Sound
- Topic: PCM maximum Hz
- Replies: 15
- Views: 16380
- Wed Jun 26, 2013 8:25 pm
- Forum: Sound
- Topic: PCM maximum Hz
- Replies: 15
- Views: 16380
- Wed Jun 19, 2013 5:59 pm
- Forum: Megadrive/Genesis
- Topic: Help figuring out some logic in Flicky - new challenge #3!
- Replies: 19
- Views: 24159