Csound Csound-dev Csound-tekno Search About

Bitshift Opcode Efficiency

Date2015-07-11 20:54
Fromandy fillebrown
SubjectBitshift Opcode Efficiency
Are the bitshift opcodes more efficient cpu-wise than the
multiplication and division opcodes, or are they just doing
multiplication and division in their code, too.

The reason I ask is because I multiply and divide by constant powers
of 2 a lot, and when I switched to using bitshift opcodes for
efficiency I found that 127 >> 7 results in a fraction which makes me
think the bitshift opcode is just dividing by 128. It makes sense
since everything is floating-point internally, so I'm wondering if
it's saving any cpu cycles to use bitshifts.

~ Andy Fillebrown

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-07-11 21:02
Fromandy fillebrown
SubjectRe: Bitshift Opcode Efficiency
Bah! Disregard that. I was tracing the wrong variable. 127 >> 7 does return 0.

On Sat, Jul 11, 2015 at 3:54 PM, andy fillebrown
 wrote:
> Are the bitshift opcodes more efficient cpu-wise than the
> multiplication and division opcodes, or are they just doing
> multiplication and division in their code, too.
>
> The reason I ask is because I multiply and divide by constant powers
> of 2 a lot, and when I switched to using bitshift opcodes for
> efficiency I found that 127 >> 7 results in a fraction which makes me
> think the bitshift opcode is just dividing by 128. It makes sense
> since everything is floating-point internally, so I'm wondering if
> it's saving any cpu cycles to use bitshifts.
>
> ~ Andy Fillebrown

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here