Problem with a division of a value bigger than 127

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem with a division of a value bigger than 127

1,532件の閲覧回数
dvw
Contributor I
This is my problem:
 
static int a;
a=127/2;
ok, a=63
 
static int a;
static int b;
a=127;
b=a/2;
ok, a=63
 
static int a;
a=128/2;
ok, a=64
 
static int a;
static int b;
a=128;
b=a/2;
Problem: a=193
 
I've tryied different types like floats, signed and unsigned int, but nothing worked...
Could someone help me to find the problem?
 
Thanks!
 
 
 
 
 
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 返信

705件の閲覧回数
CrasyCat
Specialist III
Hello
 
- Which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
To retrieve that info:
- Start CodeWarrior
- Select Help -> About Freescale CodeWarrior
- Click on "Install Products"
- CodeWarrior version used is displayed on top in the Installed Products dialog.
 
CrasyCat
0 件の賞賛
返信