Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #20296

Re: dynamically determine whether running on 32-bit or 64-bit platform

Newsgroups comp.lang.forth
Date 2013-03-05 09:01 -0800
References <716dba7a-65b2-421f-8a0a-a69480c23fc4@googlegroups.com> <alpine.BSF.2.00.1303051148030.69374@yoko.controlq.com>
Message-ID <0dec38fd-c8cb-45d1-bf61-e075e27607fc@googlegroups.com> (permalink)
Subject Re: dynamically determine whether running on 32-bit or 64-bit platform
From Bob Wilkinson <wilkinson.bob@gmail.com>

Show all headers | View raw


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

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web