* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: rz3utils.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
* utility programs for rstzip3
* Copyright (C) 2003 Sun Microsystems, Inc.
#include "rz3_bitarray.h"
#include "rz3_valuecache.h"
static int rz3_nbits(uint64_t v
) {
template <class vtype
> struct rz3_tagged_table
{
rz3_tagged_table(int size
) {
tags
= new uint64_t [sz
];
delete [] tags
; tags
= NULL
;
delete [] data
; data
= NULL
;
bzero(tags
, sz
*sizeof(uint64_t));
bzero(data
, sz
*sizeof(vtype
));
void set(uint64_t key
, const vtype value
) {
int idx
= (key
& (sz
-1));
vtype
get(uint64_t key
) {
}; // template <class vtype> struct rz3_tagged_table
template <class vtype
> struct rz3_table
{
delete [] data
; data
= NULL
;
bzero(data
, sz
*sizeof(vtype
));
void set(uint64_t key
, const vtype value
) {
int idx
= (key
& (sz
-1));
vtype
get(uint64_t key
) {
}; // template <class vtype> struct rz3_table
// proximity list - used in rstzip3 to exploit temporal-spatial locality
// to compress ea_va and regval/memval values
}; // struct rz3_prox_elem
rz3_prox_list(int size
) {
arr
= new rz3_prox_elem
[sz
];
arr
[i
].prev
= &(arr
[i
-1]);
arr
[i
].next
= &(arr
[i
+1]);
} // for each allocated elem
uint64_t lookup(int idx
) {
// returns the index if match, -1 otherwise
// if v is found in the prox list, it is moved
// to the head of the list ("most recent" position)
rz3_prox_elem
* pe
= arr
;
assert(pe
->prev
== NULL
);
if (pe
->data
== v
) break;
pe
->prev
->next
= pe
->next
;
pe
->next
->prev
= pe
->prev
;
// pe is last - move it to the head
}; // struct rz3_prox_list