Re: OT: Processor register size
On Mon, 2005-04-11 at 20:20 -0500, Timothy Flechtner wrote: wouldn't a pointer be register size? Depends on the CPU architecture. E.g. some have a mixture of register sizes (especially 8-bit CPUs, but also 16-bit ones). On the PDP11 series an int was typically 16 bits and so was a register, but a pointer would be 32 bits (and so was a long). typedef unsigned char byte; byte word[sizeof(float)]; A float almost never fits into a register (except on the FPU of course), but that expression will get you the numbe of bytes that a float uses in memory, which seems to be what you want. You could also use #define FLOAT_BYTES sizeof(float) Liam -- Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin Pictures from old books: http://www.holoweb.net/~liam/pictures/oldbooks/ IRC (chat) programs: www.ircreviews.org/clients/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
OT: Processor register size
Does anyone know of a reliable way of obtaining the register size of a processor? I built a GUI that saves/loads binary data and I'm contemplating the option of making it portable to other architectures (currently intel 32 bit). My first idea is simply to use something like this although I don't know if this is reliable and/or sloppy: typedef unsigned char byte; byte word[sizeof(float)]; Thanks! MQ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: OT: Processor register size
Isn't INT the register size by default? sizeof(int) = register size? Kevin On Monday 11 April 2005 07:51 pm, MQ wrote: Does anyone know of a reliable way of obtaining the register size of a processor? I built a GUI that saves/loads binary data and I'm contemplating the option of making it portable to other architectures (currently intel 32 bit). My first idea is simply to use something like this although I don't know if this is reliable and/or sloppy: typedef unsigned char byte; byte word[sizeof(float)]; Thanks! MQ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: OT: Processor register size
wouldn't a pointer be register size? -tim Kevin DeKorte wrote: Isn't INT the register size by default? sizeof(int) = register size? Kevin On Monday 11 April 2005 07:51 pm, MQ wrote: Does anyone know of a reliable way of obtaining the register size of a processor? I built a GUI that saves/loads binary data and I'm contemplating the option of making it portable to other architectures (currently intel 32 bit). My first idea is simply to use something like this although I don't know if this is reliable and/or sloppy: typedef unsigned char byte; byte word[sizeof(float)]; Thanks! MQ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list