示例#1
0
void luaC_freeall (lua_State *L) {
  global_State *g = G(L);
  int i;
  g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT);  /* mask to collect all elements */
  sweepwholelist(L, &g->rootgc);
  for (i = 0; i < g->strt.size; i++)  /* free all string lists */
    sweepwholelist(L, &g->strt.hash[i]);
}
示例#2
0
文件: lgc.c 项目: littlesome/xLua
/*
** Performs a full GC cycle; if 'isemergency', set a flag to avoid
** some operations which could change the interpreter state in some
** unexpected ways (running finalizers and shrinking some structures).
** Before running the collection, check 'keepinvariant'; if it is true,
** there may be some objects marked as black, so the collector has
** to sweep all objects to turn them back to white (as white has not
** changed, nothing will be collected).
*/
void luaC_fullgc (lua_State *L, int isemergency) {
  global_State *g = G(L);
  lua_assert(g->gckind == KGC_NORMAL);
  if (isemergency) g->gckind = KGC_EMERGENCY;  /* set flag */
  if (keepinvariant(g)) {  /* black objects? */
    entersweep(L); /* sweep everything to turn them back to white */
  }
  /* finish any pending sweep phase to start a new cycle */
  luaC_runtilstate(L, bitmask(GCSpause));
  luaC_runtilstate(L, ~bitmask(GCSpause));  /* start new collection */
  luaC_runtilstate(L, bitmask(GCScallfin));  /* run up to finalizers */
  /* estimate must be correct after a full GC cycle */
  lua_assert(g->GCestimate == gettotalbytes(g));
  luaC_runtilstate(L, bitmask(GCSpause));  /* finish collection */
  g->gckind = KGC_NORMAL;
  setpause(g);
}
示例#3
0
 /**
  * Is the Id in the set?
  *
  * @param id The Id to check.
  */
 bool get(T id) const noexcept override final {
     if (chunk_id(id) >= m_data.size()) {
         return false;
     }
     auto* r = m_data[chunk_id(id)].get();
     if (!r) {
         return false;
     }
     return (r[offset(id)] & bitmask(id)) != 0;
 }
示例#4
0
bool IPV6Cidr::isMember(const struct in6_addr &addr) const
{
	struct in6_addr host = addr;

	bitmask((bit_t *)&host, (bit_t *)&netmask, sizeof(host));
	if(!memcmp(&host, &network, sizeof(host)))
		return true;

	return false;
}
示例#5
0
DepthFrame::DepthFrame(cv::Mat mat) : Frame(mat / 8)//, m_pCloud(new pcl::PointCloud<pcl::PointXYZ>)
{
	// Player index map
    cv::Mat bitmask (mat.rows, mat.cols, mat.type(), cv::Scalar(7));
    cv::bitwise_and(mat, bitmask, m_UIDMat);
	m_UIDMat.convertTo(m_UIDMat, CV_8UC1);
    
    // Create a point cloud
//    MatToPointCloud(Frame::get(), *m_pCloud);
}
示例#6
0
static void generationalcollection (lua_State *L) {
  global_State *g = G(L);
  if (g->lastmajormem == 0) {  /* signal for another major collection? */
    luaC_fullgc(L, 0);  /* perform a full regular collection */
    g->lastmajormem = gettotalbytes(g);  /* update control */
  }
  else {
    luaC_runtilstate(L, ~bitmask(GCSpause));  /* run complete cycle */
    luaC_runtilstate(L, bitmask(GCSpause));
    if (gettotalbytes(g) > g->lastmajormem/100 * g->gcmajorinc)
      g->lastmajormem = 0;  /* signal for a major collection */
  }
  luaE_setdebt(g, stddebt(g));
}
示例#7
0
void comb(int N, int K)
{
    std::string bitmask(K, 1); // K leading 1's
    bitmask.resize(N, 0); // N-K trailing 0's

    // print integers and permute bitmask
    do {
        for (int i = 0; i < N; ++i) // [0..N-1] integers
        {
            if (bitmask[i]) std::cout << " " << i;
        }
        std::cout << std::endl;
    } while (std::prev_permutation(bitmask.begin(), bitmask.end()));
}
示例#8
0
文件: lstate.c 项目: duchuan123/ravi
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
  int i;
  lua_State *L;
  global_State *g;
  LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG)));
  if (l == NULL) return NULL;
  L = &l->l.l;
  g = &l->g;
  g->ravi_writeline = ravi_default_writeline;
  g->ravi_writestring = ravi_default_writestring;
  g->ravi_writestringerror = ravi_default_writestringerror;
  g->ravi_debugger_data = NULL;
  L->next = NULL;
  L->tt = LUA_TTHREAD;
  g->currentwhite = bitmask(WHITE0BIT);
  L->marked = luaC_white(g);
  preinit_thread(L, g);
  g->frealloc = f;
  g->ud = ud;
  g->mainthread = L;
  g->seed = makeseed(L);
  g->gcrunning = 0;  /* no GC while building state */
  g->GCestimate = 0;
  g->strt.size = g->strt.nuse = 0;
  g->strt.hash = NULL;
  setnilvalue(&g->l_registry);
  g->panic = NULL;
  g->version = NULL;
  g->gcstate = GCSpause;
  g->gckind = KGC_NORMAL;
  g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL;
  g->sweepgc = NULL;
  g->gray = g->grayagain = NULL;
  g->weak = g->ephemeron = g->allweak = NULL;
  g->twups = NULL;
  g->totalbytes = sizeof(LG);
  g->GCdebt = 0;
  g->gcfinnum = 0;
  g->gcpause = LUAI_GCPAUSE;
  g->gcstepmul = LUAI_GCMUL;
  g->ravi_state = NULL;
  for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
  raviV_initjit(L);
  if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
    /* memory allocation error: free partial state */
    close_state(L);
    L = NULL;
  }
  return L;
}
示例#9
0
bool bitarray_get(const bitarray_t *const bitarray, const size_t bit_index) {
  assert(bit_index < bitarray->bit_sz);

  // We're storing bits in packed form, 8 per byte.  So to get the nth
  // bit, we want to look at the (n mod 8)th bit of the (floor(n/8)th)
  // byte.
  //
  // In C, integer division is floored explicitly, so we can just do it to
  // get the byte; we then bitwise-and the byte with an appropriate mask
  // to produce either a zero byte (if the bit was 0) or a nonzero byte
  // (if it wasn't).  Finally, we convert that to a boolean.
  return (bitarray->buf[bit_index / 8] & bitmask(bit_index)) ?
             true : false;
}
示例#10
0
Solver::Solver() {

	max = sqrt( static_cast<float>(MAX) );	// sqrt(9) = 3

	// Build board and sets
	for (unsigned int i = 0; i < MAX*MAX; i++) {
		squares[i] = Square( i );
	}

	for (int i = 0; i < MAX; i++) {

		for (int y = 0; y < MAX; y++) {

			// horizontal
			sets[i].Add		( &squares[ y + (i * MAX) ] );		
			squares[ y + (i * MAX) ].LinkHLine( &sets[i] );

			// vertical
			sets[i+MAX].Add	( &squares[ (y * MAX) + i ] );		
			squares[ (y * MAX) + i ].LinkVLine( &sets[i+MAX] );

			// bigsquare
			sets[i+MAX*2].Add	( &squares[ GetSquareIdFromRegion(i,y) ] );	
			squares[ GetSquareIdFromRegion(i,y) ].LinkBigSquare( &sets[i+MAX*2] );
	
		}
	}

	// Build a list of possible number combinations
	for (int combosize = 2; combosize <= 5; combosize++) {
				
		std::string bitmask(combosize, 1); // K leading 1's
		bitmask.resize(MAX, 0); // N-K trailing 0's

		// save integers and permute bitmask
		do {

			std::vector<int> combo;

			for (int i = 0; i < MAX; ++i) // [0..N-1] integers
			{
				if (bitmask[i]) {
					combo.push_back(i);
				}
			}
			numberCombos.push_back(combo);
		} while (std::prev_permutation(bitmask.begin(), bitmask.end()));
	}
}
示例#11
0
void IPV6Cidr::set(const char *cp)
{
	char cbuf[INET_IPV6_ADDRESS_SIZE];
	char *ep;

	memset(&netmask, 0, sizeof(netmask));
	bitset((bit_t *)&netmask, getMask(cp));
	setString(cbuf, sizeof(cbuf), cp);
	ep = (char *)strchr(cp, '/');
	if(ep)
		*ep = 0;

	inet_pton(AF_INET6, cbuf, &network);
	bitmask((bit_t *)&network, (bit_t *)&netmask, sizeof(network));
}
示例#12
0
bool IPV6Cidr::isMember(const struct sockaddr *saddr) const
{
	struct sockaddr_in6 *addr = (struct sockaddr_in6 *)saddr;
	struct in6_addr host;

	if(saddr->sa_family != AF_INET6)
		return false;

	memcpy(&host, &addr->sin6_addr, sizeof(host));
	bitmask((bit_t *)&host, (bit_t *)&netmask, sizeof(host));
	if(!memcmp(&host, &network, sizeof(host)))
		return true;

	return false;
}
示例#13
0
float comb(std::vector<float> & v, int N, int K) {
	std::string bitmask(K, 1); // K leading 1's
	bitmask.resize(N, 0); // N-K trailing 0's
	float sum_prob = 0;
	do {
		float prob = 1;
		for (int i = 0; i < N; ++i) {
			if (bitmask[i]) prob *= v[i];
			else prob *= (1 - v[i]);
		}
		std::cout << prob << std::endl;
		sum_prob += prob;
	} while (std::prev_permutation(bitmask.begin(), bitmask.end()));
	return sum_prob;
}
示例#14
0
void bitarray_set(bitarray_t *const bitarray,
                  const size_t bit_index,
                  const bool value) {
  assert(bit_index < bitarray->bit_sz);

  // We're storing bits in packed form, 8 per byte.  So to set the nth
  // bit, we want to set the (n mod 8)th bit of the (floor(n/8)th) byte.
  //
  // In C, integer division is floored explicitly, so we can just do it to
  // get the byte; we then bitwise-and the byte with an appropriate mask
  // to clear out the bit we're about to set.  We bitwise-or the result
  // with a byte that has either a 1 or a 0 in the correct place.
  bitarray->buf[bit_index / 8] =
      (bitarray->buf[bit_index / 8] & ~bitmask(bit_index)) |
           (value ? bitmask(bit_index) : 0);
}
示例#15
0
文件: lgc.c 项目: crazii/mameplus
/*
** change GC mode
*/
void luaC_changemode (lua_State *L, int mode) {
	global_State *g = G(L);
	if (mode == g->gckind) return;  /* nothing to change */
	if (mode == KGC_GEN) {  /* change to generational mode */
	/* make sure gray lists are consistent */
	luaC_runtilstate(L, bitmask(GCSpropagate));
	g->GCestimate = gettotalbytes(g);
	g->gckind = KGC_GEN;
	}
	else {  /* change to incremental mode */
	/* sweep all objects to turn them back to white
	   (as white has not changed, nothing extra will be collected) */
	g->gckind = KGC_NORMAL;
	entersweep(L);
	luaC_runtilstate(L, ~sweepphases);
	}
}
示例#16
0
std::vector<std::vector<size_t>> generateCommutativeCombinations(size_t numNumbers, size_t combinationSize) // From rosettacode.org
{
    std::string bitmask(combinationSize, 1);
    bitmask.resize(numNumbers, 0);

    std::vector<std::vector<size_t>> combos;
    do
    {
        combos.emplace_back();
        auto& c = combos.back();
        for(size_t i = 0; i < numNumbers; ++i)
            if(bitmask[i])
                c.push_back(i);
    } while(std::prev_permutation(bitmask.begin(), bitmask.end()));

    return combos;
}
示例#17
0
namespace DrakeCollision
{

  const bitmask ALL_MASK(bitmask(0).set());
  const bitmask NONE_MASK(0);
  const bitmask DEFAULT_GROUP(1);

  enum DRAKECOLLISION_EXPORT ModelType {
    NONE,
    AUTO,
    BULLET
  };

  unique_ptr<Model> newModel(ModelType model_type)
  {
    switch (model_type) {
      case NONE:
        return unique_ptr<Model>(new Model());
        break;
      case BULLET:
#ifdef BULLET_COLLISION
        return unique_ptr<Model>(new BulletModel());
#else
        cerr << "Recompile with Bullet enabled (-DBULLET_COLLISION) to use Bullet collision models." << endl;
#endif
        break;
      default:
        cerr << model_type << " is not a recognized collision model type." << endl;
    }
    return unique_ptr<Model>();
  };

  unique_ptr<Model> newModel()
  {
#ifdef BULLET_COLLISION
    return newModel(BULLET);
#else
    return newModel(NONE);
#endif
  }


};
示例#18
0
文件: lgc.c 项目: crazii/mameplus
static void generationalcollection (lua_State *L) {
	global_State *g = G(L);
	lua_assert(g->gcstate == GCSpropagate);
	if (g->GCestimate == 0) {  /* signal for another major collection? */
	luaC_fullgc(L, 0);  /* perform a full regular collection */
	g->GCestimate = gettotalbytes(g);  /* update control */
	}
	else {
	lu_mem estimate = g->GCestimate;
	luaC_runtilstate(L, bitmask(GCSpause));  /* run complete (minor) cycle */
	g->gcstate = GCSpropagate;  /* skip restart */
	if (gettotalbytes(g) > (estimate / 100) * g->gcmajorinc)
		g->GCestimate = 0;  /* signal for a major collection */
	else
		g->GCestimate = estimate;  /* keep estimate from last major coll. */

	}
	setpause(g, gettotalbytes(g));
	lua_assert(g->gcstate == GCSpropagate);
}
示例#19
0
void IPV6Cidr::set(const char *cp)
{
    char cbuf[INET_IPV6_ADDRESS_SIZE];
    char *ep;

    memset(&netmask, 0, sizeof(netmask));
    bitset((bit_t *)&netmask, getMask(cp));
    setString(cbuf, sizeof(cbuf), cp);
    ep = (char *)strchr(cp, '/');
    if(ep)
        *ep = 0;

#ifdef  _MSWINDOWS_
    int slen = sizeof(network);
    WSAStringToAddressA(cbuf, AF_INET6, NULL, (struct sockaddr*)&network, &slen);
#else
    inet_pton(AF_INET6, cbuf, &network);
#endif
    bitmask((bit_t *)&network, (bit_t *)&netmask, sizeof(network));
}
示例#20
0
void IPV4Cidr::set(const char *cp)
{
	char cbuf[INET_IPV4_ADDRESS_SIZE];
	char *ep;
	unsigned dots = 0;
#ifdef	WIN32
	DWORD addr;
#endif

	memset(&netmask, 0, sizeof(netmask));
	bitset((bit_t *)&netmask, getMask(cp));
	setString(cbuf, sizeof(cbuf), cp);
	
#if defined(_MSC_VER) && _MSC_VER >= 1500
	ep = (char *)strchr(cp, '/');
#else
 	ep = (char *)strchr(cp, '/');
#endif

	if(ep)
		*ep = 0;

	cp = cbuf;
	while(NULL != (cp = strchr(cp, '.'))) {
		++dots;
		++cp;
	}

	while(dots++ < 3)
		addString(cbuf, sizeof(cbuf), ".0");

#ifdef	WIN32
	addr = inet_addr(cbuf);
	memcpy(&network, &addr, sizeof(network));
#else
	inet_aton(cbuf, &network);
#endif
	bitmask((bit_t *)&network, (bit_t *)&netmask, sizeof(network));
}
void set_bonus_t::init( const player_t& p )
{
  count = 0;
  bool result = false;

  for( auto& i : p.items )
    {

      // Before checking through the armoring filters we should check that we're even
      // looking at a valid item
      if ( mask != 0 &&
           ( mask & bitmask( static_cast<slot_type>( i.slot ) ) ) == 0 )
        continue;

      result = false;


      // Campaign and above pieces (ilevel >=61) bonuses are attached to the armoring
      // On all new imports setbonus should be handled entirely by the import
      set_bonus_t* sb = p.find_set_bonus( i.setbonus() );

      if ( sb )
        {
          if ( sb -> name == name)
            result = true;
        }
      // this is only left in place to maintain past scripts
      // comment out the else to remove support and only base bonuses on the setbonus attribute
      else
        result = decode_by_shell( i );


      if ( result )
        ++count;
    }

  has_2pc = force_enable_2pc || ( ! force_disable_2pc && count >= 2 );
  has_4pc = force_enable_4pc || ( ! force_disable_4pc && count >= 4 );
}
示例#22
0
文件: 8byte.c 项目: kal667/bitfield-c
// TODO is this funciton necessary anymore? is it any faster for uint64_t than
// get_bitfield(data[], ...)? is the performance better on a 32 bit platform
// like the PIC32?
uint64_t eightbyte_get_bitfield(uint64_t source, const uint16_t offset,
        const uint16_t bit_count, const bool data_is_big_endian) {
    int startByte = offset / CHAR_BIT;
    int endByte = (offset + bit_count - 1) / CHAR_BIT;

    if(!data_is_big_endian) {
        source = __builtin_bswap64(source);
    }

    uint8_t* bytes = (uint8_t*)&source;
    uint64_t ret = bytes[startByte];
    if(startByte != endByte) {
        // The lowest byte address contains the most significant bit.
        uint8_t i;
        for(i = startByte + 1; i <= endByte; i++) {
            ret = ret << 8;
            ret = ret | bytes[i];
        }
    }

    ret >>= 8 - find_end_bit(offset + bit_count);
    return ret & bitmask(bit_count);
}
vector<vector<int> > comb(int N, int K)
{
	std::string bitmask(K, 1);	// K leading 1's
	bitmask.resize(N, 0);		// N-K trailing 0's

	vector<vector<int> > all_combination;
	int comb_counter = 0;
	// print integers and permute bitmask
	do {
		all_combination.push_back(vector<int>());
		for (int i = 0; i < N; ++i) // [0..N-1] integers
		{
			if (bitmask[i])
			{
				//std::cout << " " << i;
				all_combination[comb_counter].push_back(i);
			}
		}
		//std::cout << std::endl;
		comb_counter++;
	} while (std::prev_permutation(bitmask.begin(), bitmask.end()));

	return all_combination;
}
示例#24
0
uint64_t getBitField(uint64_t data, int startBit, int numBits) {
    int startByte = startingByte(startBit);
    int endByte = endingByte(startBit, numBits);

    uint64_t dataCopy = data;
    if(bigEndian()) {
        dataCopy = __builtin_bswap64(data);
    }
    uint8_t* bytes = (uint8_t*)&dataCopy;
    uint64_t ret = bytes[startByte];
    
    //debugNoNewline("Reading CAN message, data = 0x");
    int i=0;
    //while(i < 8) {
    //    debugNoNewline("%02x ", bytes[i]);
    //    i++;
    //}
    //debugNoNewline("\r\n");
    
    uint8_t isLittleEndian = 0;
    if(startByte != endByte) {
        if(!isLittleEndian) {
            // The lowest byte address contains the most significant bit.
            for(i = startByte + 1; i <= endByte; i++) {
                ret = ret << 8;
                ret = ret | bytes[i];
            }
        } else {
            // do something here for little endian?
        }
    }

    ret >>= 8 - findEndBit(startBit, numBits);
    ret = ret & bitmask(numBits);
    return ret;
}
示例#25
0
/**
 * TODO it would be nice to have a warning if you call with this a value that
 * won't fit in the number of bits you've specified it should use.
 */
void setBitField(uint64_t* data, uint64_t value, int startBit, int numBits) {
    int shiftDistance = 64 - startBit - numBits;
    value <<= shiftDistance;
    *data &= ~(bitmask(numBits) << shiftDistance);
    *data |= value;
}
示例#26
0
void bitarray_set(bitarray_t *ba, size_t bit_index, bool val) {
  assert(bit_index < ba->bit_sz);
  ba->buf[bit_index / 8] = (ba->buf[bit_index / 8] & ~bitmask(bit_index)) | (val ? bitmask(bit_index) : 0); 
}
示例#27
0
bool bitarray_get(bitarray_t *ba, size_t bit_index) {
  assert(bit_index < ba->bit_sz);
  return (ba->buf[bit_index / 8] & bitmask(bit_index)) ? true : false;
}
示例#28
0
文件: lgc.c 项目: zapline/zlib
static void cleartable (lua_State *L, GCObject *l) {
#else
static void cleartable (GCObject *l) {
#endif /* LUA_REFCOUNT */
  while (l) {
    Table *h = gco2h(l);
    int i = h->sizearray;
    lua_assert(testbit(h->marked, VALUEWEAKBIT) ||
               testbit(h->marked, KEYWEAKBIT));
    if (testbit(h->marked, VALUEWEAKBIT)) {
      while (i--) {
        TValue *o = &h->array[i];
#if LUA_REFCOUNT
        if (iscleared(o, 0)) { /* value was collected? */
          if (iscollectable(o))
            o->value.gc->gch.ref--;
          setnilvalue2n(l, o);  /* remove value */
        }
#else
        if (iscleared(o, 0))  /* value was collected? */
          setnilvalue(o);  /* remove value */
#endif /* LUA_REFCOUNT */
      }
    }
    i = sizenode(h);
    while (i--) {
      Node *n = gnode(h, i);
      if (!ttisnil(gval(n)) &&  /* non-empty entry? */
          (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) {
#if LUA_REFCOUNT
        if (iscollectable(gval(n)))
          gval(n)->value.gc->gch.ref--;
        setnilvalue2n(L, gval(n));  /* remove value ... */
#else
        setnilvalue(gval(n));  /* remove value ... */
#endif /* LUA_REFCOUNT */
        removeentry(n);  /* remove entry from table */
      }
    }
    l = h->gclist;
  }
}


static void freeobj (lua_State *L, GCObject *o) {
  switch (o->gch.tt) {
    case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
    case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break;
    case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;
    case LUA_TTABLE: luaH_free(L, gco2h(o)); break;
    case LUA_TTHREAD: {
      lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread);
      luaE_freethread(L, gco2th(o));
      break;
    }
    case LUA_TSTRING: {
      G(L)->strt.nuse--;
      luaM_freemem(L, o, sizestring(gco2ts(o)));
      break;
    }
#if LUA_WIDESTRING
    case LUA_TWSTRING: {
      G(L)->strt.nuse--;
      luaM_freemem(L, o, sizestring(gco2ts(o)));
      break;
    }
#endif /* LUA_WIDESTRING */
    case LUA_TUSERDATA: {
      luaM_freemem(L, o, sizeudata(gco2u(o)));
      break;
    }
    default: lua_assert(0);
  }
}



#define sweepwholelist(L,p)	sweeplist(L,p,MAX_LUMEM)


static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
  GCObject *curr;
  global_State *g = G(L);
  int deadmask = otherwhite(g);
  while ((curr = *p) != NULL && count-- > 0) {
    if (curr->gch.tt == LUA_TTHREAD)  /* sweep open upvalues of each thread */
      sweepwholelist(L, &gco2th(curr)->openupval);
    if ((curr->gch.marked ^ WHITEBITS) & deadmask) {  /* not dead? */
      lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT));
      makewhite(g, curr);  /* make it white (for next cycle) */
      p = &curr->gch.next;
    }
    else {  /* must erase `curr' */
      lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT));
#if LUA_REFCOUNT
      if (curr->gch.prev)
        curr->gch.prev->gch.next = curr->gch.next;
      if (curr->gch.next)
        curr->gch.next->gch.prev = (GCObject*)p;
#endif /* LUA_REFCOUNT */
      *p = curr->gch.next;
      if (curr == g->rootgc)  /* is the first element of the list? */
        g->rootgc = curr->gch.next;  /* adjust first */
      freeobj(L, curr);
    }
  }
  return p;
}
示例#29
0
static void geninittype P2 (const EXPR *, ep, unsigned char *, data)
{
    TYP    *tp = ep->etp;
    UVAL    uval;

    
#ifdef FLOAT_SUPPORT
    RVAL    rvl;

    
#endif /* FLOAT_SUPPORT */
	UNUSEDARG (data);
    switch (tp->type) {
    case bt_bool:
	put_char (ep);
	break;
    case bt_char:
    case bt_charu:
    case bt_uchar:
    case bt_schar:
	put_char (ep);
	break;
    case bt_short:
    case bt_ushort:
    case bt_int16:
    case bt_uint16:
	put_short (ep);
	break;
    case bt_pointer16:
    case bt_pointer32:
	break;
    case bt_bitfield:
    case bt_ubitfield:
    case bt_bbitfield:
	uval = ep->v.u & bitmask (bitfield_width (tp));
	break;
    case bt_int32:
    case bt_uint32:
    case bt_ulong:
    case bt_long:
	put_long (ep);
	break;
    case bt_struct:
	break;
    case bt_union:
	break;
	
#ifdef FLOAT_SUPPORT
    case bt_float:
	floatexpr (tp, &rvl);
	put_float (&rvl);
	break;
    case bt_double:
	floatexpr (tp, &rvl);
	put_double (&rval);
	break;
    case bt_longdouble:
	floatexpr (tp, &rvl);
	put_longdouble (&rvl);
	break;
	
#endif /* FLOAT_SUPPORT */
    case bt_func:
	break;
    default:
	break;
    }
}
uint8_t Trex_Rover::bitmaskMotorCommand(uint8_t & cmd, motor_state left, motor_state right)
{
	cmd |= bitmask(left, _rover.left);
	cmd |= bitmask(right, _rover.right);
	return cmd;
}