unsigned

libxml2 questions about xmlChar*

I'm using libxml2. All function are working with xmlChar*. I found that xmlChar is an unsigned char. So I have some questions about how to work with it. 1) For example if I working with utf-16 or utf-32 file how libxml2 process it and returns xmlChar in function? Will I lose some characters then?? 2) If I want to do something with th...

Unsigned Overflow in C

Consider the following piece of C code: #include <stdint.h> uint32_t inc(uint16_t x) { return x+1; } When compiled with gcc-4.4.3 with flags -std=c99 -march=core2 -msse4.1 -O2 -pipe -Wall on a pure x86_64 system, it produces movzwl %di,%eax inc %eax retq Now, unsigned overflow is predicted in C. I do not know much about x86_64...

Data type promotions during arithmetic operations

main() { if ( -1 < (unsigned char) 1 ) printf("less than"); else printf("NOT less than"); } what is happening? (unsigned char)1 converted to (signed char)1 then: (signed)-1 < (signed)1 thus answer "less than" problem:- in above code change if ( (-1 < (unsigned int) 1 ) answer "NOT less than". So its obvious ...

double precision integer subtraction with 32-bit registers(MIPS)

I am learning computer arithmetic. The book I use(Patterson and Hennessey) lists the below question. Write mips code to conduct double precision integer subtraction for 64-bit data. Assume the first operand to be in registers $t4(hi) and $t5(lo), second in $t6(hi) and $t7(lo). My solution to the answer is sub $t3, $t5, ...