hash - #ifndef_LIB_KERNEL_HASH_H#define_LIB_KERNEL_HASH_H...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#ifndef __LIB_KERNEL_HASH_H #define __LIB_KERNEL_HASH_H /* Hash table. This data structure is thoroughly documented in the Tour of Pintos for Project 3. This is a standard hash table with chaining. To locate an element in the table, we compute a hash function over the element's data and use that as an index into an array of doubly linked lists, then linearly search the list. The chain lists do not use dynamic allocation. Instead, each structure that can potentially be in a hash must embed a struct hash_elem member. All of the hash functions operate on these `struct hash_elem's. The hash_entry macro allows conversion from a struct hash_elem back to a structure object that contains it. This is the same technique used in the linked list implementation. Refer to lib/kernel/list.h for a detailed explanation. */ #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include "list.h" /* Hash element. */ struct hash_elem { struct list_elem list_elem; }; /* Converts pointer to hash element HASH_ELEM into a pointer to
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/19/2010 for the course EE 142 taught by Professor John during the Spring '04 term at Abraham Baldwin Agricultural College.

Page1 / 2

hash - #ifndef_LIB_KERNEL_HASH_H#define_LIB_KERNEL_HASH_H...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online