algorithm


How to “NOT” a register in mips assembly


Since there isn't a NOT logical operator in mips assembly, how can one "not" the contents of a register?
Load -1 into another register, then XOR the registers.
https://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/bitwise.html
You can use nor and the zero-register to fit everything into one instruction:
nor $<dest_reg> $<in_reg> $zero
Another approach would be using xor and -1 as this is encoded as 1111...1111 in 2s-component.
li $<help_reg>, -1 # load -1 into help-register
xor $<dest_reg>, $<in_reg>, $<help_reg> # actual not-operation

Related Links

How is pre-computation handled by complexity notation?
Smallest missing integer algorithm that runs in O(n)?
Recursively deleting nodes from a balanced tree
Programming a probability to allow an AI decide when to discard a card or not in 5 card poker
How to approximate the sum of number of divisors from 1 to n?
Why is it mandatory that Dijkstra's algorithm extracts min in each round?
case matching strings based on an algorithm. Which algorithm should I use?
Compressed Sparse Row (CSR): How do you store empty rows?
Why Shortest Job First(SJF) algorithm is not used instead of FCFS at final level in Multilevel Feedback Scheduling
Do Red-Black tree and AVL tree have same balance condition?
Calculate the formula from pseudo code
How many sets of 4 numbers are there such that their xor is equal to 0?
Compare growth rate of two functions. (Tricky)
Scala Stream Method takeWhile
Runtime of following algorithm?
What is the highest suitable integer for rolling modulo hasing?

Categories

HOME
windows
sonarqube
nvd3.js
css3
powerpoint
package
nsbundle
telegram-bot
odoo-8
pkcs#11
okhttp
jquery-ui-sortable
fhir
appcelerator-studio
text-mining
siddhi
rtf
stellar.js
symbol
keytool
modbus-tcp
wolframalpha
production
cgbitmapcontext
scriptella
rpgle
recurring-events
powershell-ise
linkedhashmap
card.io
jett
sharding
least-squares
alphabetical
android-augmented-reality
kill
azure-arm
magento-1.9.3
vmware-fusion
dbnull
placeholder
angular-http
monkey-testing
magento-2.0.7
reportservice2010
amq
headless
otp
visual-studio-2008-sp1
iotivity
clipboard.js
jtwig
kango-framework
turbo-prolog
lz77
highland.js
evolus-pencil
finalbuilder
zscript
viola-jones
bcache
teaspoon
spring-remoting
vsx
getopt
android-usb
inputmismatchexception
beaker-testing
nebula
joomla-template
cardreader
asplinkbutton
redis-py
uimanageddocument
web-farm
dajaxice
garbage
apache-whirr
azman
google-maps-mobile
luabind
convention
entity-attribute-value
saxparseexception
entitydatasource
pylucene
mbeans
cac
firefox-3
pbcopy
mathematical-typesetting

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App