Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Ads

Discussion Groups

Discussion Groups | Freescale DSPs | bit-wise shift operator problem

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

bit-wise shift operator problem - mark...@bish.net - Oct 4 13:10:00 2005




56805 DSP and I am trying to shift 16 places to the left into an unsigned
long (32-bit size).

unsigned long big_value = 0;

big_value = 1 << 16;

big_value is still zero.

What am I missing?




(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

Re: bit-wise shift operator problem - R.A.Imhoff - Oct 5 0:28:00 2005

Hello Mark

you probably have to type-cast the "1" into a long before the shift
operationg, otherwise the compiler treats it as a short integer,
shifting its 1 bit into nothingness.

big_value = (long)(1) << 16;

Best regards
Robert

On 04.10.2005, at 19:10, mark@mark... wrote: > 56805 DSP and I am trying to shift 16 places to the left into an
> unsigned
> long (32-bit size).
>
> unsigned long big_value = 0;
>
> big_value = 1 << 16;
>
> big_value is still zero.
>
> What am I missing?





(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

RE:bit-wise shift operator problem - guse...@rambler.ru - Oct 5 8:19:00 2005

Try this:
big_value = 1UL<<16; // 1 - unsinged long
big_value = (ungigned long)1<<16;




(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )