Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the java code: public int hashCode() { int h = hash; if (h == 0) { int off = offset; char val[] =

This is the java code:

public int hashCode() {

int h = hash; if (h == 0) { int off = offset; char val[] = value; int len = count; for (int i = 0; i < len; i++) { h = 31*h + val[off++]; } hash = h; } return h; }

----------------------------------------------------------------------

Here is the MIPS code that I am given:

.data String1: .asciiz "Let's find the hash of this string." .align 2 Answer1: .word 1584150063 String2: .asciiz "Essayons cette phrase en franais." # let's try this sentence in French .align 2 Answer2: .word 268858203 OK1: .asciiz "The hash code for String1 is correct. " Error1: .asciiz "The hash code for String1 is incorrect. " OK2: .asciiz "The hash code for String2 is correct. " Error2: .asciiz "The hash code for String2 is incorrect. "

.text la $a0, String1 jal hashCode addi $t0, $v0, 0 la $t1, Answer1 lw $t2, 0($t1) beq $t0, $t2, String1OK la $a0, Error1 j OneDone String1OK: la $a0, OK1 OneDone: addi $v0, $0, 4 syscall

la $a0, String2 jal hashCode addi $t0, $v0, 0 la $t1, Answer2 lw $t2, 0($t1) beq $t0, $t2, String2OK la $a0, Error2 j TwoDone String2OK: la $a0, OK2 TwoDone: addi $v0, $0, 4 syscall

addi $v0, $0, 10 syscall

hashCode: #$a0 Address of string #$v0 hashcode #your code here

You only have to do the program from here by converting the java code above into MIPS language so that it fits in the MIPS code I've already provided.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

What do you understand by Mendeleev's periodic table

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago