RE: BITRSHIFT(n,1) v n/2

2015-07-30 Thread Darren
(ASC(SUBSTR(m.vcBuffer, 3,1)), 16) +; BITLSHIFT(ASC(SUBSTR(m.vcBuffer, 4,1)), 24) ENDFUNC -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Laurie Alvey Sent: Thursday, 30 July 2015 7:58 PM To: profoxt...@leafe.com Subject: Re: BITRSHIFT(n,1) v n

Re: BITRSHIFT(n,1) v n/2

2015-07-30 Thread Jean MAURICE
Hi Darren, I confirm your values ! It's not useful to compute with BITRSHIFT as I do for ...a long time. But it prooves something : VFP is very quick The Foxil ___ Post Messages to: ProFox@leafe.com Subscription Maintenance:

Re: BITRSHIFT(n,1) v n/2

2015-07-30 Thread Jean MAURICE
Hi Laurie, read in help : Integer /html/e2e6eeaf-b170-4a8c-b826-c5127938d8d6.htm *Numeric* value with no decimals For example, a line number in an order. 4 bytes -2147483647 to 2147483647 But I don't think that CAST would throw an error in case of overflow.

Re: BITRSHIFT(n,1) v n/2

2015-07-30 Thread Gene Wirchenko
At 02:57 2015-07-30, Laurie Alvey trukke...@gmail.com wrote: Interesting. If I issue ? CAST(8E9 As I) it displays a negative 9 digit number (-589934592). Also, I thought the limit for 32 bit integers was about 2E9. That is the limit, yes, but your value overflowed. The cast stripped the

Re: BITRSHIFT(n,1) v n/2

2015-07-30 Thread Laurie Alvey
Interesting. If I issue ? CAST(8E9 As I) it displays a negative 9 digit number (-589934592). Also, I thought the limit for 32 bit integers was about 2E9. Laurie On 29 July 2015 at 13:42, Jean MAURICE jsm.maur...@wanadoo.fr wrote: Hi Laurie, I do think that BITRSHIFT is a lot quicker than /2.

BITRSHIFT(n,1) v n/2

2015-07-29 Thread Laurie Alvey
I was wondering if there was any speed difference between n = BITRSHIFT(n,1) and n = n/2. I ran this: LOCAL k As Integer, s As Double k = 8E9 s = SECONDS() DO WHILE k 1 k = k / 2 ENDDO ? SECONDS() - s k = 8E9 s = SECONDS() DO WHILE k 1 k = BITRSHIFT(k,1) ENDDO ? SECONDS() - s The first loop

Re: BITRSHIFT(n,1) v n/2

2015-07-29 Thread Jean MAURICE
Hi Laurie, I do think that BITRSHIFT is a lot quicker than /2. BITRSHIFT can be done with only one machine cycle (clock tic); the division is a lot more complex. BUT ! this is true only if K is an integer (k = CAST(8E9 AS integer)). Otherwise you must add add the conversion time between