MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions
MFM::StaticLoader< CC, BITS > Class Template Reference

#include <StaticLoader.h>

Static Public Member Functions

static u32 AllocateType (const UUID &forUUID)
 
static s32 TypeFromUUID (const UUID &forUUID)
 
static s32 TypeFromCompatibleUUID (const UUID &forUUID)
 
static const UUIDUUIDOfType (u32 type)
 

Detailed Description

template<class CC, u32 BITS>
class MFM::StaticLoader< CC, BITS >

Horrible globally-centralized all-static hack to assign type codes without having an interTile type-map exchange protocol to allow us to assign types on a per-Tile basis. This code will not work at all on truly distributed hardware.

StaticLoader attempts to assign reasonably well-spaced typecodes to minimize the chance of bit flips converting one type into another legal type (assuming it escapes detection by the ECC). It increments a counter but, rather than using the counter value directly, it then 'expands' the count across the bits as widely as possible, based on the current position of the leftmost 1 bit in the counter. This causes collisions, so the array of assigned types is used to reject them. A last-ditch pass of 'unexpanded' bits ensures all 1<<BITS types are eventually assigned; the counter will reach 2<<BITS if that happens.

On sixteen bits, the assigned numbers sequence starts out like this: 0x0000, 0xffff, 0x00ff, 0xff00, 0x001f, 0x03e0, 0x03ff, 0x7c00, 0x7c1f, ...

Member Function Documentation

template<class CC , u32 BITS>
s32 MFM::StaticLoader< CC, BITS >::TypeFromCompatibleUUID ( const UUID forUUID)
static

Return a 'compatible type' assigned to forUUID, or -1 if no such UUID is not found. Note this is O(#types)! Not for inner loop use!

template<class CC , u32 BITS>
s32 MFM::StaticLoader< CC, BITS >::TypeFromUUID ( const UUID forUUID)
static

Return the type assigned to forUUID, or -1 if the UUID is not found. Note this is O(#types)! Not for inner loop use!

template<class CC , u32 BITS>
static const UUID* MFM::StaticLoader< CC, BITS >::UUIDOfType ( u32  type)
inlinestatic

Return a pointer to the UUID associated with a given type or 0 if the type has not been assigned. O(1).


The documentation for this class was generated from the following files: