0

I have an integer that may have the most significant bits different or equal.

I want to chekc for that.

Actually I do:

struct obj{
  public: 
  Token t;
  bool isNumber(){return t<<1>>1==t;} 

Instead I would like to do something like:

struct obj{
  public:
  Token t;
  bool isNumber(){t+t;return ProcessorOverflowFlag;}

Is there any way to do it in g++ or clang

George Kourtis
  • 2,381
  • 3
  • 18
  • 28
  • What is `Token`? What are you trying to determine about `t`? – Dark Falcon Jun 10 '14 at 17:59
  • Token is a typedef of signed integer. – George Kourtis Jun 10 '14 at 18:11
  • An overflow only occurs when you're doing arithmetic on two numbers. You have `t`. How are you expecting an overflow? In other words, why do you care if `t+t` overflows? – Dark Falcon Jun 10 '14 at 18:12
  • I need to contain inside an integer two things: an integer staring from -0x4000.0000 to 0x3FFF.FFFF and the others going from 0x4000.0000 to 0x7FFF.FFFF and those going from -0x8000.0000 to -0x4000.0001 . Depending on the case I will interpret the integer as number or pointer. – George Kourtis Jun 10 '14 at 18:18
  • When the integer is between -0x4000.0000 to 0x3FFF.FFFF if it gets addeed to itself it doesn't overflow. – George Kourtis Jun 10 '14 at 18:23

0 Answers0