Constants optimization
-
Hi all =) An easy one. I'm just not sure the compiler does this the way I think it does... The following expression would be evaluted to a constant, right?
(tOC(1) << (sizeof(T) << 3)) - 1
Lets say that, when compiled, the code will no longer be an expression, but a constant value. But what about this?oc & ((tOC(1) << (sizeof(T) << 3)) - 1)
Evaluates to:oc & const
Is this right? Best regards -
Hi all =) An easy one. I'm just not sure the compiler does this the way I think it does... The following expression would be evaluted to a constant, right?
(tOC(1) << (sizeof(T) << 3)) - 1
Lets say that, when compiled, the code will no longer be an expression, but a constant value. But what about this?oc & ((tOC(1) << (sizeof(T) << 3)) - 1)
Evaluates to:oc & const
Is this right? Best regards -
hint_54 wrote:
tOC(1)
:confused:
hint_54 wrote:
oc
:confused: ????
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Hi all =) An easy one. I'm just not sure the compiler does this the way I think it does... The following expression would be evaluted to a constant, right?
(tOC(1) << (sizeof(T) << 3)) - 1
Lets say that, when compiled, the code will no longer be an expression, but a constant value. But what about this?oc & ((tOC(1) << (sizeof(T) << 3)) - 1)
Evaluates to:oc & const
Is this right? Best regardsTake a look into the last sentence in my signature
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
-
Take a look into the last sentence in my signature
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson