Why movzbl is used in assembly when casting unsigned char to signed data types?
问题 I'm learning data movement( MOV ) in assembly. I tried to compile some code to see the assembly in a x86_64 Ubuntu 18.04 machine: typedef unsigned char src_t; typedef xxx dst_t; dst_t cast(src_t *sp, dst_t *dp) { *dp = (dst_t)*sp; return *dp; } where src_t is unsigned char . As for the dst_t , I tried char , short , int and long . The result is shown below: // typedef unsigned char src_t; // typedef char dst_t; // movzbl (%rdi), %eax // movb %al, (%rsi) // typedef unsigned char src_t; //