算法
常用算法
Konwledging
这个作者很懒,什么都没留下…
展开
-
Weighted round-robin
//weighted_round_robin.ctypedef struct node { LinkListNode node; int weight; int effective_weight; int current_weight; int name;}node_t;int get_total_weight(void* list) { int i; int total_weight = 0; for (i = 0; i < L原创 2021-01-06 22:29:54 · 231 阅读 · 0 评论 -
CRC-32(x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1) source code
#include <stdio.h> //x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1//encode high bit before low bit ..[high bit...low bit]unsigned int crc32(unsigned char data, unsigned int crc) { unsigned int crc32 = 0x04C11DB7; int i; crc ^= (data<<原创 2020-09-29 16:43:31 · 972 阅读 · 0 评论 -
CRC16(X16+X15+X2+1) source code
#include <stdio.h> //x16+x15+x2+1: encode high bit before low bit ..[high bit...low bit] unsigned short crc16(unsigned char data, unsigned short crc) { unsigned short ccitt16 = 0x8005; int i; crc ^= (data<<8); for (i=0; i<8; i++){ if原创 2020-09-29 15:27:44 · 1811 阅读 · 0 评论