Re: [LAD] Bit shift

2019-03-17 Thread Will Godfrey
On Sun, 17 Mar 2019 20:12:04 +0100 Robin Gareus wrote: >On 3/17/19 5:56 PM, Jonathan Brickman wrote: >> That is likely to change depending on GCC optimization setting, no? > >Not usually. It depends on the target architecture more than anything. > >Even with -O0, gcc translates integer

Re: [LAD] Bit shift

2019-03-17 Thread Robin Gareus
On 3/17/19 5:56 PM, Jonathan Brickman wrote: > That is likely to change depending on GCC optimization setting, no? Not usually. It depends on the target architecture more than anything. Even with -O0, gcc translates integer addition and multiplications into a combination of bitwise and

Re: [LAD] Bit shift

2019-03-17 Thread Gordonjcp
On Sun, Mar 17, 2019 at 11:56:40AM -0500, Jonathan Brickman wrote: > That is likely to change depending on GCC optimization setting, no? > This is why you can't trust very high level languages like C, and should be wary of high-level languages like assembler. -- Gordonjcp

Re: [LAD] Bit shift

2019-03-17 Thread karl
J.E.B: > That is likely to change depending on GCC optimization setting, no? Then, why don't you just test it to find out, you have the means to that after all. Regards, /Karl Hammar ___ Linux-audio-dev mailing list

Re: [LAD] Bit shift

2019-03-17 Thread Jonathan Brickman
That is likely to change depending on GCC optimization setting, no? J.E.B. On Sat, Mar 16, 2019, 5:12 PM wrote: > Will Godfrey: > > On Wed, 13 Mar 2019 00:09:17 +0100 (CET) > > k...@aspodata.se wrote: > > > > >Will Godfrey: > > >> Does anyone know if GCC will replace power of 2 >

Re: [LAD] Bit shift

2019-03-16 Thread karl
Will Godfrey: > On Wed, 13 Mar 2019 00:09:17 +0100 (CET) > k...@aspodata.se wrote: > > >Will Godfrey: > >> Does anyone know if GCC will replace power of 2 multiplications/divisions > >> of > >> unsigned integers with bit shifts? ... > >$ cat a.c > >#include > > > >int main(int argc, char

Re: [LAD] Bit shift

2019-03-16 Thread Will J Godfrey
On Wed, 13 Mar 2019 00:09:17 +0100 (CET) k...@aspodata.se wrote: >Will Godfrey: >> Does anyone know if GCC will replace power of 2 multiplications/divisions of >> unsigned integers with bit shifts? > >Test on your system: > >$ cat a.c >#include > >int main(int argc, char *argv[]) { > uint16_t

Re: [LAD] Bit shift

2019-03-12 Thread karl
Will Godfrey: > Does anyone know if GCC will replace power of 2 multiplications/divisions of > unsigned integers with bit shifts? Test on your system: $ cat a.c #include int main(int argc, char *argv[]) { uint16_t b = argc * 2; return b; } $ gcc -S a.c $ cat a.s ... main: .LFB0: