예제 #1
0
void HashBase::Set(int i, unsigned _hash) {
	if(map) {
		Link& lnk = link[i];
		Unlink(i, lnk);
		int& mi = Maph(_hash & ~UNSIGNED_HIBIT);
		int ii = mi;
		if(ii < 0)
			mi = lnk.prev = lnk.next = i;
		else
		if(i < ii) {
			LinkBefore(i, lnk, ii);
			mi = i;
		}
		else {
			int l = ii;
			int h = link[ii].prev;
			if(h - i < i - l) {
				while(i < h) {
					h = link[h].prev;
				}
				LinkBefore(i, lnk, link[h].next);
			}
			else {
				l = link[l].next;
				while(i > l && l != ii) {
					l = link[l].next;
				}
				LinkBefore(i, lnk, l);
			}
		}
	}
	hash[i] = _hash & ~UNSIGNED_HIBIT;
}
예제 #2
0
파일: LabelBase.cpp 프로젝트: pedia/raidget
DisplayPopup::DisplayPopup()
{
	SetFrame(BlackFrame());
	display = NULL;
	paper = ink = Null;
	style = 0;
	item = slim = Null;
	margin = 0;
	ONCELOCK {
		InstallStateHook(StateHook);
	}
	LinkBefore(all());
}
예제 #3
0
파일: tcp_test.c 프로젝트: FFalcon/osdev
void Ipv4SendIntf(NetIntf *intf, const Ipv4Addr *nextAddr,
    const Ipv4Addr *dstAddr, u8 protocol, NetBuf *pkt)
{
    uint len = pkt->end - pkt->start;

    Packet *packet = malloc(sizeof(Packet));
    packet->phdr.src = intf->ipAddr;
    packet->phdr.dst = *dstAddr;
    packet->phdr.reserved = 0;
    packet->phdr.protocol = protocol;
    packet->phdr.len = NetSwap16(len);

    memcpy(packet->data, pkt->start, len);
    packet->end = packet->data + len;

    LinkBefore(&s_outPackets, &packet->link);

    NetReleaseBuf(pkt);
}
예제 #4
0
Sqlite3Connection::Sqlite3Connection(Sqlite3Session& the_session, sqlite3 *the_db)
:	session(the_session), db(the_db), current_stmt(NULL), got_first_row(false), got_row_data(false)
{
	LinkBefore(&session.clink);
}