Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: DSP sign extend question
Posted by: mikro Oct,30.2013-14:09 

Don't know whether it's the fastest way but I remember one nice trick (courtesy of Kalms, IIRC):

(writing from the top of my head, so excuse any typos/errors!)

; x0 = 16bit input
move #>$008000,x1

move x0,a
and x1,a ; isolate the sign bit
eor x1,a ; flip
sub x1,a ; create mask
or x0,a ; a = sign extended result

Another way could have been two MPYs + Tcc + but I'm lazy to try it out :)







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
DSP sign extend question Thadoss Oct,30.2013-01:28
  Re: DSP sign extend question mikro Oct,30.2013-11:43
    Re: DSP sign extend question Thadoss Oct,30.2013-12:37
      Re: DSP sign extend question mikro Oct,30.2013-14:09
        Re: DSP sign extend question ggn Oct,30.2013-14:55
          Re: DSP sign extend question ggn Oct,30.2013-16:03
        Re: DSP sign extend question Thadoss Oct,30.2013-17:43
        Re: DSP sign extend question Thomas / New Beat Nov,07.2013-08:59
          Re: DSP sign extend question Thomas / New Beat Dec,11.2013-09:29
            Re: DSP sign extend question Thomas / New Beat Dec,12.2013-20:14


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson