Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22153

Why use a bitwise not in MIPS instead of using exactly value?

$
0
0

I'm trying to learn MIPS assembly, but I'm a bit confused about an example of MIPS assembly I have found.

#Socket Domain - AF_INET (2)li $t4, 0xFFFFFFFD #-3not $a0, $t4#Socket Type - SOCK_STREAM (2 for mips)not $a1, $t4#Socket Protocol - 0slti $a2, $zero, 0xFFFF#Call socketli $v0, 4183syscall 0x42424

For the socket() syscall, there are 3 arguments. The first argument being AF_INET or 2, why does the example above not just use li $a0, 2 instead of:

li $t4, 0xFFFFFFFD #-3 not $a0, $t4

The line below is also used, what is the purpose of this with regards to the socket called?

slti $a2, $zero, 0xFFFF

Is this just the way the assembly has been 'optomized' by GCC? Or is their a reason?


Viewing all articles
Browse latest Browse all 22153

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>