Questions tagged [internal-representation]

23 questions
0
votes
3 answers

Subtraction of 2 negative integer (two's complement) never overflowing

I came across this in a computer architecture textbook: Subtracting a strictly negative integer from another strictly negative integer (in two's complement) will never overflow. The textbook doesn't go on to explain this assertion. It piqued my…
0
votes
3 answers

Incorrect result when using %d placeholder in a pow() function in C

I'm trying to finish some basic coding exercise and I have already figured out how to fix it but I would just really like to understand what's going on. #include #include int main(void) { int first, second, third, fourth,…
0
votes
2 answers

About int and unsigned int

There are the following programs: #include int main(void) { int i=2147483647; unsigned int j=4294967295; printf("%d %d %d\n",i,i+1,i+2); printf("%u %u %u\n",j,j+1,j+2); return 0; } Why i+2 is not equal to -2147483646 ? why…
0
votes
1 answer

Soot - Map from java class to jimple

With the following code I can get the jimple representation of a java .class file: soot.Main.main(args); SootClass mainClass = Scene.v().getMainClass(); String methodSignature = "void main(java.lang.String[])"; …
0
votes
2 answers

Convert the internal representation of a float stored in an integer to an actual float

I have the internal representation of a float stored in a uint32_t. Suppose we have two of them with those conditions. I want to sum the two floats represented by the uint32_t and then store their internal representation inside another uint32_t.…
0
votes
0 answers

How different computers know which signed integers representation was used by each other

How different computers know which signed integers representation was used by each other? For example, if I send two's complement method encoded inetegers via network, how does clients know that it was two's complement method instead of, for…
0
votes
3 answers

C++ Writing an Interpreter - determining loops target for break statement c++

I am writing a simple program interpreter in c++. When I am building the internal representation of the program and I get a break statement, how do I determine the encompassing loops target location? void Imp::whilestmt() { Expr *pExpr; …
Samuel French
  • 665
  • 3
  • 11
  • 22
-2
votes
4 answers

I learned that in C language char type ranges from -128 to 127, but it doesn't seem like that

This might be a very basic problem, but I couldn't manage to. Here is what I am working with. #include int main(void) { char c1, c2; int s; c1 = 128; c2 = -128; s = sizeof(char); printf("size of char: %d\n", s); …
agongji
  • 117
  • 1
  • 7
1
2