Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* think-o: ARM register byte ps VS fps?
@ 2002-04-17 13:06 Andrew Cagney
  2002-04-18  2:57 ` Richard Earnshaw
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cagney @ 2002-04-17 13:06 UTC (permalink / raw)
  To: gdb

Hello,

I'm looking at the code:

static int
arm_register_byte (int regnum)
{
   if (regnum < ARM_F0_REGNUM)
     return regnum * INT_REGISTER_RAW_SIZE;
   else if (regnum < ARM_PS_REGNUM)
     return (NUM_GREGS * INT_REGISTER_RAW_SIZE
	    + (regnum - ARM_F0_REGNUM) * FP_REGISTER_RAW_SIZE);
   else
     return (NUM_GREGS * INT_REGISTER_RAW_SIZE
	    + NUM_FREGS * FP_REGISTER_RAW_SIZE
	    + (regnum - ARM_FPS_REGNUM) * STATUS_REGISTER_SIZE);
}

where:

#define ARM_FPS_REGNUM 24	/* floating point status register */
#define ARM_PS_REGNUM 25	/* Contains processor status */

While I suspect it ``works'', would ``(regnum < ARM_FPS_REGNUM)'' be better?

enjoy,
Andrew


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: think-o: ARM register byte ps VS fps?
  2002-04-17 13:06 think-o: ARM register byte ps VS fps? Andrew Cagney
@ 2002-04-18  2:57 ` Richard Earnshaw
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw @ 2002-04-18  2:57 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb, Richard.Earnshaw

> Hello,
> 
> I'm looking at the code:
> 
> static int
> arm_register_byte (int regnum)
> {
>    if (regnum < ARM_F0_REGNUM)
>      return regnum * INT_REGISTER_RAW_SIZE;
>    else if (regnum < ARM_PS_REGNUM)
>      return (NUM_GREGS * INT_REGISTER_RAW_SIZE
> 	    + (regnum - ARM_F0_REGNUM) * FP_REGISTER_RAW_SIZE);
>    else
>      return (NUM_GREGS * INT_REGISTER_RAW_SIZE
> 	    + NUM_FREGS * FP_REGISTER_RAW_SIZE
> 	    + (regnum - ARM_FPS_REGNUM) * STATUS_REGISTER_SIZE);
> }
> 
> where:
> 
> #define ARM_FPS_REGNUM 24	/* floating point status register */
> #define ARM_PS_REGNUM 25	/* Contains processor status */
> 
> While I suspect it ``works'', would ``(regnum < ARM_FPS_REGNUM)'' be better?
> 
> enjoy,
> Andrew
> 

Rewriting it as a table of constants would probably be better still.

I'll add it to my (copious) todo list.

R.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-18  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-17 13:06 think-o: ARM register byte ps VS fps? Andrew Cagney
2002-04-18  2:57 ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox