Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #20294 > unrolled thread
| Started by | Bob Wilkinson <wilkinson.bob@gmail.com> |
|---|---|
| First post | 2013-03-05 08:38 -0800 |
| Last post | 2013-03-06 01:23 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.forth
dynamically determine whether running on 32-bit or 64-bit platform Bob Wilkinson <wilkinson.bob@gmail.com> - 2013-03-05 08:38 -0800
Re: dynamically determine whether running on 32-bit or 64-bit platform Rob Sciuk <rob@controlq.com> - 2013-03-05 11:50 -0500
Re: dynamically determine whether running on 32-bit or 64-bit platform Bob Wilkinson <wilkinson.bob@gmail.com> - 2013-03-05 09:01 -0800
Re: dynamically determine whether running on 32-bit or 64-bit platform Coos Haak <chforth@hccnet.nl> - 2013-03-06 01:23 +0100
| From | Bob Wilkinson <wilkinson.bob@gmail.com> |
|---|---|
| Date | 2013-03-05 08:38 -0800 |
| Subject | dynamically determine whether running on 32-bit or 64-bit platform |
| Message-ID | <716dba7a-65b2-421f-8a0a-a69480c23fc4@googlegroups.com> |
I have some code which worked on older 32-bit processors but which gave incorrect answers on a 64-bit machine. I found out that I no longer had to use 2constant and fm/mod, and that if I use constant and /mod I get correct answers. Made sense after I had made the change. Is there a standard way to dynamically determine whether code is running on a 32-bit or 64-bit machine? I guess my code would look quite convoluted, however it is done? Maybe some pre-processing would give cleaner code? e.g. in pseudocode #if64bit 600851475143 constant penumber #else 3851020999 139 2constant penumber #endif .... #if64bit /mod #else fm/mod #endif Bob
[toc] | [next] | [standalone]
| From | Rob Sciuk <rob@controlq.com> |
|---|---|
| Date | 2013-03-05 11:50 -0500 |
| Message-ID | <alpine.BSF.2.00.1303051148030.69374@yoko.controlq.com> |
| In reply to | #20294 |
On Tue, 5 Mar 2013, Bob Wilkinson wrote: > Date: Tue, 5 Mar 2013 08:38:35 -0800 (PST) > From: Bob Wilkinson <wilkinson.bob@gmail.com> > Newsgroups: comp.lang.forth > Subject: dynamically determine whether running on 32-bit or 64-bit platform > > I have some code which worked on older 32-bit processors but which gave incorrect answers on a 64-bit machine. > > I found out that I no longer had to use 2constant and fm/mod, and that if I use constant and /mod I get correct answers. Made sense after I had made the change. > > Is there a standard way to dynamically determine whether code is running on a 32-bit or 64-bit machine? > > I guess my code would look quite convoluted, however it is done? Maybe some pre-processing would give cleaner code? > > e.g. in pseudocode > > #if64bit > 600851475143 constant penumber > #else > 3851020999 139 2constant penumber > #endif > > .... > > #if64bit > /mod > #else > fm/mod > #endif > > Bob Try: 1 CELLS .
[toc] | [prev] | [next] | [standalone]
| From | Bob Wilkinson <wilkinson.bob@gmail.com> |
|---|---|
| Date | 2013-03-05 09:01 -0800 |
| Message-ID | <0dec38fd-c8cb-45d1-bf61-e075e27607fc@googlegroups.com> |
| In reply to | #20295 |
On Tuesday, March 5, 2013 4:50:27 PM UTC, Rob Sciuk wrote: > On Tue, 5 Mar 2013, Bob Wilkinson wrote: > > > > > Date: Tue, 5 Mar 2013 08:38:35 -0800 (PST) > > > From: Bob Wilkinson <wilkinson.bob@gmail.com> > > > Newsgroups: comp.lang.forth > > > Subject: dynamically determine whether running on 32-bit or 64-bit platform > > > > > > I have some code which worked on older 32-bit processors but which gave incorrect answers on a 64-bit machine. > > > > > > I found out that I no longer had to use 2constant and fm/mod, and that if I use constant and /mod I get correct answers. Made sense after I had made the change. > > > > > > Is there a standard way to dynamically determine whether code is running on a 32-bit or 64-bit machine? > > > > > > I guess my code would look quite convoluted, however it is done? Maybe some pre-processing would give cleaner code? > > > > > > e.g. in pseudocode > > > > > > #if64bit > > > 600851475143 constant penumber > > > #else > > > 3851020999 139 2constant penumber > > > #endif > > > > > > .... > > > > > > #if64bit > > > /mod > > > #else > > > fm/mod > > > #endif > > > > > > Bob > > > > Try: > > > > 1 CELLS . Thanks for that - I can make that work :-) Bob
[toc] | [prev] | [next] | [standalone]
| From | Coos Haak <chforth@hccnet.nl> |
|---|---|
| Date | 2013-03-06 01:23 +0100 |
| Message-ID | <jh8v73oy0r7j.khwfcevft0s4.dlg@40tude.net> |
| In reply to | #20294 |
Op Tue, 5 Mar 2013 08:38:35 -0800 (PST) schreef Bob Wilkinson:
> I have some code which worked on older 32-bit processors but which gave incorrect answers on a 64-bit machine.
>
> I found out that I no longer had to use 2constant and fm/mod, and that if I use constant and /mod I get correct answers. Made sense after I had made the change.
>
> Is there a standard way to dynamically determine whether code is running on a 32-bit or 64-bit machine?
>
> I guess my code would look quite convoluted, however it is done? Maybe some pre-processing would give cleaner code?
>
> e.g. in pseudocode
>
> #if64bit
> 600851475143 constant penumber
> #else
> 3851020999 139 2constant penumber
Or simply, without needing a calculation:
600851475143. 2constant penumber
> #endif
>
8 cells 64 = -> 64 bit, assuming 1 byte is 8 bits
8 cells 32 = -> 32 bit, idem
--
Coos
CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.forth
csiph-web