short permissions = 0755;
short requested = 0700;
short result = permissions & requested;
I get a compiler error:
error possible loss of precision
found : int
required: short
If I'm not totally wrong the result of binary AND is as long as the longest operand. Why is the result an integer?
Would there be a performance hit, if I would cast to short?
(short) permissions & requested
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…