type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
includes | #include <pthread.h> |
defines | #define QLZ_COMPRESSION_LEVEL 1 |
defines | #define QLZ_STREAMING_BUFFER 0 |
defines | #define X86X64 |
defines |
#define MINOFFSET 2 |
defines | #define UNCONDITIONAL_MATCHLEN 6 |
defines | #define UNCOMPRESSED_END 4 |
defines | #define CWORD_LEN 4 |
functions | int qlz_get_setting(int setting)
{
switch (setting) {
case 0:
return QLZ_COMPRESSION_LEVEL;
case 1:
return QLZ_SCRATCH_COMPRESS;
case 2:
return QLZ_SCRATCH_DECOMPRESS;
case 3:
return QLZ_STREAMING_BUFFER;
#ifdef QLZ_MEMORY_SAFE
case 6:
return 1;
#else
... |
functions | void reset_state(unsigned char hash_counter[QLZ_HASH_VALUES])
{
memset(hash_counter, 0, QLZ_HASH_VALUES);
} |
functions | ui32 hash_func(ui32 i)
{
#if QLZ_COMPRESSION_LEVEL == 2
return ((i >> 9) ^ (i >> 13) ^ i) & (QLZ_HASH_VALUES - 1);
#else
return ((i >> 12) ^ i) & (QLZ_HASH_VALUES - 1);
#endif
} |
functions | ui32 fast_read(void const *src, ui32 bytes)
{
#ifndef X86X64
unsigned char *p = (unsigned char *) src;
switch (bytes) {
case 4:
return (*p | *(p + 1) << 8 | *(p + 2) << 16 | *(p + 3) << 24);
case 3:
return (*p | *(p + 1) << 8 | *(p + 2) << 16);
case 2:
return (*p | *(p + 1) <... |
functions | void fast_write(ui32 f, void *dst, size_t bytes)
{
#ifndef X86X64
unsigned char *p = (unsigned char *) dst;
switch (bytes) {
case 4:
*p = (unsigned char) f;
*(p + 1) = (unsigned char) (f >> 8);
*(p + 2) = (unsigned char) (f >> 16);
*(p + 3) = (unsigned char) (f >> 24);
... |
functions | else
switch (bytes) {
case 4:
*((ui32 *) dst) = f;
return;
case 3:
*((ui32 *) dst) = f;
return;
case 2:
*((ui16 *) dst) = (ui16) f;
return;
case 1:
*((unsigned char *) dst) = (unsigned char) f;
return;
} |
functions | void memcpy_up(unsigned char *dst,
const unsigned char *src, ui32 n)
{
// Caution if modifying memcpy_up! Overlap of dst and src must be special handled.
#ifndef X86X64
unsigned char *end = dst + n;
while (dst < end) {
*dst = *src;
dst++;
src++;
} |
functions | void update_hash(qlz_hash_decompress h[QLZ_HASH_VALUES],
unsigned char counter[QLZ_HASH_VALUES],
const unsigned char *s)
{
#if QLZ_COMPRESSION_LEVEL == 1
ui32 hash, fetch;
fetch = fast_read(s, 3);
hash = hash_func(fetch);
h[hash].offset[0... |
functions | void update_hash_upto(qlz_hash_decompress h[QLZ_HASH_VALUES],
unsigned char counter[QLZ_HASH_VALUES],
unsigned char **lh, const unsigned char *max)
{
while (*lh < max) {
(*lh)++;
update_hash(h, counter, *lh);
} |
functions | size_t qlz_compress_core(const unsigned char *source,
unsigned char *destination, size_t size,
qlz_hash_compress
hashtable[QLZ_HASH_VALUES],
unsigned char
hash_... |
functions | 3
if (matchlen > 2 && src - o < 131071) {
ui32 u;
size_t offset = src - o;
for (u = 1; u < matchlen; u++) {
fetch = fast_read(src + u, 3);
hash = hash_func(fetch);
c = hash_counter[hash]++;
... |
functions | else if (matchlen == 3 && offset <= 16383) {
ui32 f = (ui32) ((offset << 2) | 1);
fast_write(f, dst, 2);
dst += 2;
} |
functions | else if (matchlen <= 18 && offset <= 1023) {
ui32 f = ((matchlen - 3) << 2) | (offset << 6) | 2;
fast_write(f, dst, 2);
dst += 2;
} |
functions | else if (matchlen <= 33) {
ui32 f = ((matchlen - 2) << 2) | (offset << 7) | 3;
fast_write(f, dst, 3);
dst += 3;
} |
functions | 2
if (matchlen > 2) {
cword_val = (cword_val >> 1) | (1U << 31);
src += matchlen;
if (matchlen < 10) {
ui32 f = best_k | ((matchlen - 2) << 2) | (hash << 5);
fast_write(f, dst, 2);
dst += 2;
... |
functions | 3
if (src <= last_byte - 3) {
#if QLZ_COMPRESSION_LEVEL == 1
ui32 hash;
fetch = fast_read(src, 3);
hash = hash_func(fetch);
hashtable[hash].offset[0] = src;
hashtable[hash].cache[0] = fetch;
hash_counter[hash] = 1;
#elif QLZ_COMPRESSION_LEV... |
functions | size_t qlz_decompress_core(const unsigned char *source,
unsigned char *destination, size_t size,
qlz_hash_decompress
hashtable[QLZ_HASH_VALUES],
unsigned char
... |
functions | size_t qlz_size_decompressed(const char *source)
{
ui32 n, r;
n = (((*source) & 2) == 2) ? 4 : 1;
r = fast_read(source + 1 + n, n);
r = r & (0xffffffff >> ((4 - n) * 8));
return r;
} |
functions | size_t qlz_size_compressed(const char *source)
{
ui32 n, r;
n = (((*source) & 2) == 2) ? 4 : 1;
r = fast_read(source + 1, n);
r = r & (0xffffffff >> ((4 - n) * 8));
return r;
} |
functions | size_t qlz_compress(const void *source, char *destination, size_t size,
char *scratch_compress)
{
unsigned char *scratch_aligned =
(unsigned char *) scratch_compress + QLZ_ALIGNMENT_PADD -
(((size_t) scratch_compress) % QLZ_ALIGNMENT_PADD);
size_t *buffersize = (size_t *) scr... |
functions | endif
if (base == 3) {
*destination = (unsigned char) (0 | compressed);
*(destination + 1) = (unsigned char) r;
*(destination + 2) = (unsigned char) size;
} |
functions | size_t qlz_decompress(const char *source, void *destination,
char *scratch_compress)
{
unsigned char *scratch_aligned =
(unsigned char *) scratch_compress + QLZ_ALIGNMENT_PADD -
(((size_t) scratch_compress) % QLZ_ALIGNMENT_PADD);
size_t *buffersize = (size_t *) scratch_alig... |
defines | #define __ARP_C |
defines |
#define HW_ETHERNET (0x0001u) // ARP Hardware type as defined by IEEE 802.3 |
defines | #define ARP_IP (0x0800u) // ARP IP packet type as defined by IEEE 802.3 |
defines | #define MAX_REG_APPS 2 // MAX num allowed registrations of Modules/Apps |
defines | #define KS_ARP_IP_MULTICAST_HACK y |
functions | CHAR ARPRegisterCallbacks(struct arp_app_callbacks *app)
{
BYTE i;
for(i=0; i<MAX_REG_APPS; i++)
{
if(!reg_apps[i].used)
{
reg_apps[i].ARPPkt_notify = app->ARPPkt_notify;
reg_apps[i].used = 1;
return (i+1); // Return Code. Should be used in deregister.
... |
functions | BOOL ARPDeRegisterCallbacks(CHAR reg_id)
{
if(reg_id <= 0 || reg_id > MAX_REG_APPS)
return FALSE;
reg_apps[reg_id-1].used = 0; // To indicate free slot for registration
return TRUE;
} |
functions | BOOL ARPSendPkt(DWORD SrcIPAddr, DWORD DestIPAddr, BYTE op_req )
{
ARP_PACKET packet;
if(op_req == ARP_REQ)
packet.Operation = ARP_OPERATION_REQ;
else if (op_req == ARP_RESP)
packet.Operation = ARP_OPERATION_RESP;
else
return FALSE; // Invalid op-code
packet.TargetMACA... |
functions | void ARPProcessRxPkt(ARP_PACKET* packet)
{
BYTE pass_on = 0; // Flag to indicate whether need to be forwarded
BYTE i;
// Probing Stage
if(AppConfig.MyIPAddr.Val == 0x00)
{
pass_on = 1; // Pass to Registered-Application for further processing
} |
functions | else if(AppConfig.MyIPAddr.Val)
{
/* Late-conflict */
if(packet->SenderIPAddr.Val == AppConfig.MyIPAddr.Val)
{
pass_on = 1;
} |
functions | BOOL ARPPut(ARP_PACKET* packet)
{
while(!MACIsTxReady());
MACSetWritePtr(BASE_TX_ADDR);
packet->HardwareType = HW_ETHERNET;
packet->Protocol = ARP_IP;
packet->MACAddrLen = sizeof(MAC_ADDR);
packet->ProtocolLen = sizeof(IP_ADDR);
// packet->SenderMACAddr = AppConfi... |
functions | void ARPInit(void)
{
Cache.MACAddr.v[0] = 0xff;
Cache.MACAddr.v[1] = 0xff;
Cache.MACAddr.v[2] = 0xff;
Cache.MACAddr.v[3] = 0xff;
Cache.MACAddr.v[4] = 0xff;
Cache.MACAddr.v[5] = 0xff;
Cache.IPAddr.Val = 0x0;
smARP = SM_ARP_IDLE;
} |
functions | BOOL ARPProcess(void)
{
ARP_PACKET packet;
static NODE_INFO Target;
#if defined(STACK_USE_AUTO_IP)
BYTE i;
#endif
switch(smARP)
{
case SM_ARP_IDLE:
// Obtain the incoming ARP packet
MACGetArray((BYTE*)&packet, sizeof(packet... |
functions | STACK_USE_AUTO_IP
if (packet.SenderIPAddr.Val == AppConfig.MyIPAddr.Val)
{
AutoIPConflict(0);
return TRUE;
} |
functions | STACK_CLIENT_MODE
if(packet.Operation == ARP_OPERATION_RESP)
{
/* #if defined(STACK_USE_AUTO_IP)
for (i = 0; i < NETWORK_INTERFACES; i++)
if (AutoIPConfigIsInProgress(i))
AutoIPConflict(i);
... |
functions | address
if(packet.Operation == ARP_OPERATION_REQ)
{
if(packet.TargetIPAddr.Val != AppConfig.MyIPAddr.Val)
{
return TRUE;
} |
functions | void ARPResolve(IP_ADDR* IPAddr)
{
ARP_PACKET packet;
#ifdef STACK_USE_ZEROCONF_LINK_LOCAL
#ifdef KS_ARP_IP_MULTICAST_HACK
if ((IPAddr->v[0] >= 224) &&(IPAddr->v[0] <= 239))
{
// "Resolve" the IP to MAC address mapping for
// IP multicast address range from 224.0.0.0 to 239... |
functions | BOOL ARPIsResolved(IP_ADDR* IPAddr, MAC_ADDR* MACAddr)
{
if((Cache.IPAddr.Val == IPAddr->Val) ||
((Cache.IPAddr.Val == AppConfig.MyGateway.Val) && ((AppConfig.MyIPAddr.Val ^ IPAddr->Val) & AppConfig.MyMask.Val)))
{
*MACAddr = Cache.MACAddr;
return TRUE;
} |
functions | void SwapARPPacket(ARP_PACKET* p)
{
p->HardwareType = swaps(p->HardwareType);
p->Protocol = swaps(p->Protocol);
p->Operation = swaps(p->Operation);
} |
includes |
#include <gegl.h> |
includes | #include <gtk/gtk.h> |
defines |
#define MAX_BATCH_SIZE 32000 |
defines |
#define parent_class gimp_canvas_parent_class |
functions | void
gimp_canvas_class_init (GimpCanvasClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->set_property = gimp_canvas_set_property;
object_class->get_property = gimp_canvas_get_property;
widget_class->unrealize ... |
functions | void
gimp_canvas_init (GimpCanvas *canvas)
{
GtkWidget *widget = GTK_WIDGET (canvas);
gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_add_events (widget, GIMP_CANVAS_EVENT_MASK);
} |
functions | void
gimp_canvas_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpCanvas *canvas = GIMP_CANVAS (object);
switch (property_id)
{
case PROP_CONFIG:
canvas->config ... |
functions | void
gimp_canvas_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpCanvas *canvas = GIMP_CANVAS (object);
switch (property_id)
{
case PROP_CONFIG:
g_value_set_object (val... |
functions | void
gimp_canvas_unrealize (GtkWidget *widget)
{
GimpCanvas *canvas = GIMP_CANVAS (widget);
if (canvas->layout)
{
g_object_unref (canvas->layout);
canvas->layout = NULL;
} |
functions | void
gimp_canvas_style_updated (GtkWidget *widget)
{
GimpCanvas *canvas = GIMP_CANVAS (widget);
GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
if (canvas->layout)
{
g_object_unref (canvas->layout);
canvas->layout = NULL;
} |
functions | gboolean
gimp_canvas_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
{
/* don't allow the default impl to invalidate the whole widget,
* we don't draw a focus indicator anyway.
*/
return FALSE;
} |
functions | gboolean
gimp_canvas_focus_out_event (GtkWidget *widget,
GdkEventFocus *event)
{
/* see focus-in-event
*/
return FALSE;
} |
functions | gboolean
gimp_canvas_focus (GtkWidget *widget,
GtkDirectionType direction)
{
GtkWidget *focus = gtk_container_get_focus_child (GTK_CONTAINER (widget));
/* override GtkContainer's focus() implementation which would always
* give focus to the canvas because it is focussable. Instead, tr... |
functions | void
gimp_canvas_set_bg_color (GimpCanvas *canvas,
GimpRGB *color)
{
GtkWidget *widget = GTK_WIDGET (canvas);
if (! gtk_widget_get_realized (widget))
return;
gdk_window_set_background_rgba (gtk_widget_get_window (widget),
(GdkRGBA *) color);
... |
includes |
#include <string.h> |
includes | #include <netinet/in.h> |
defines |
#define MAXENTMC_POWER_SUB_HEADER_SIZE MAXENTMC_ALIGNED_SIZE(sizeof(maxentmc_index_t *),sizeof(struct maxentmc_power_struct)) |
defines | #define MAXENTMC_POWER_HEADER_SIZE(s) MAXENTMC_ALIGNED_SIZE(sizeof(maxentmc_index_t),MAXENTMC_POWER_SUB_HEADER_SIZE+sizeof(maxentmc_index_t *)*(s)) |
defines | #define MAXENTMC_POWER_MAX_POWER_SIZE(s,d) MAXENTMC_ALIGNED_SIZE(sizeof(maxentmc_index_t),MAXENTMC_POWER_HEADER_SIZE(s)+sizeof(maxentmc_index_t)*(d)) |
defines | #define MAXENTMC_POWER_SIZE(s,d) MAXENTMC_ALIGNED_SIZE(MAXENTMC_CACHE_LINE_SIZE,MAXENTMC_POWER_MAX_POWER_SIZE(s,d)+sizeof(maxentmc_index_t)*(s)*(d)) |
defines |
#define MAXENTMC_MAX(a,b) ((a)>(b))?(a):(b) |
structs | struct maxentmc_product_list_link_struct {
size_t i1, i2;
struct maxentmc_product_list_link_struct * next;
}; |
structs | struct maxentmc_product_sparse_array_struct {
maxentmc_index_t * power;
struct maxentmc_product_list_link_struct * product_data;
size_t product_data_size;
}; |
structs | struct maxentmc_product_ordered_list_struct {
maxentmc_index_t * power;
struct maxentmc_product_list_link_struct * product_data;
size_t product_data_size;
struct maxentmc_product_ordered_list_struct * next;
}; |
functions | size_t maxentmc_bincoeff(size_t const n, size_t const k)
{
size_t i, b[n+1];
b[0] = 1;
for (i=1; i<=n; ++i){
b[i] = 1;
size_t j;
for(j=i-1; j; --j)
b[j] += b[j-1];
} |
functions | int maxentmc_power_comparison(maxentmc_index_t const dimension, maxentmc_index_t const * const p1, maxentmc_index_t const * const p2)
{
/** First see how the sums are related **/
size_t i, sum_p1=0, sum_p2=0;
maxentmc_float_t m1 = 0.0, m2 = 0.0, v1 = 0.0, v2 = 0.0;
for(i=0;i<dimension;++i){
su... |
functions | maxentmc_index_t maxentmc_index_t_ntoh(maxentmc_index_t x)
{
switch(sizeof(maxentmc_index_t)){
case sizeof(uint8_t):
return x;
break;
case sizeof(uint16_t):
return ntohs(x);
break;
case sizeof(uint32_t):
return ntohl(x);
... |
functions | size_t maxentmc_size_t_ntoh(size_t x)
{
switch(sizeof(size_t)){
case sizeof(uint8_t):
return x;
break;
case sizeof(uint16_t):
return ntohs(x);
break;
case sizeof(uint32_t):
return ntohl(x);
break;
case sizeof(uin... |
functions | maxentmc_index_t maxentmc_index_t_hton(maxentmc_index_t x)
{
switch(sizeof(maxentmc_index_t)){
case sizeof(uint8_t):
return x;
break;
case sizeof(uint16_t):
return htons(x);
break;
case sizeof(uint32_t):
return htonl(x);
... |
functions | size_t maxentmc_size_t_hton(size_t x)
{
switch(sizeof(size_t)){
case sizeof(uint8_t):
return x;
break;
case sizeof(uint16_t):
return htons(x);
break;
case sizeof(uint32_t):
return htonl(x);
break;
case sizeof(uin... |
functions | int maxentmc_power_find(struct maxentmc_power_struct const * const d, maxentmc_index_t const * const p, size_t * const pos)
{
MAXENTMC_CHECK_NULL(d);
MAXENTMC_CHECK_NULL(p);
MAXENTMC_CHECK_NULL(pos);
size_t const sdim = sizeof(maxentmc_index_t)*d->dimension;
maxentmc_index_t const * const * const p... |
functions | int maxentmc_power_get_power(struct maxentmc_power_struct const * const d, size_t const pos, maxentmc_index_t * const p)
{
MAXENTMC_CHECK_NULL(d);
MAXENTMC_CHECK_NULL(p);
if(pos>=d->size)
return -1;
memcpy(p,d->power[pos],sizeof(maxentmc_index_t)*d->dimension);
return 0;
} |
functions | void maxentmc_power_init(struct maxentmc_power_struct * const d, size_t const size, maxentmc_index_t const dimension)
{
/** Partition the space **/
d->properties = 0;
d->dimension = dimension;
d->max_power = 0;
d->size = size;
d->num_refs = 0;
pthread_mutex_init(&d->lock,NULL);
d->power... |
functions | int maxentmc_power_inc_refs(struct maxentmc_power_struct * const d)
{
MAXENTMC_CHECK_NULL(d);
pthread_mutex_lock(&d->lock);
++(d->num_refs);
pthread_mutex_unlock(&d->lock);
return 0;
} |
functions | void maxentmc_power_free(struct maxentmc_power_struct * const d)
{
if(d){
pthread_mutex_lock(&d->lock);
switch(d->num_refs){
case 0: /** No vectors attached **/
pthread_mutex_unlock(&d->lock);
pthread_mutex_destroy(&d->lock);
free(d);
... |
functions | int maxentmc_power_update_max_power(struct maxentmc_power_struct * const p)
{
MAXENTMC_CHECK_NULL(p);
maxentmc_index_t const dimension = p->dimension;
maxentmc_index_t * const max_power_per_dim = p->max_power_per_dimension;
size_t const size = p->size;
size_t i;
for(i=0;i<dimension;++i)
... |
functions | int maxentmc_power_print(struct maxentmc_power_struct const * const d, FILE * const out)
{
MAXENTMC_CHECK_NULL(d);
MAXENTMC_CHECK_NULL(out);
fprintf(out,"dimension = %u, size = %zu, max_power = %u, num_refs = %zu,",d->dimension,d->size,d->max_power,d->num_refs);
if(MAXENTMC_POWER_CHECK_PROPERTY(MAXENT... |
functions | int maxentmc_power_fwrite(struct maxentmc_power_struct const * const power, FILE * const out)
{
MAXENTMC_CHECK_NULL(power);
MAXENTMC_CHECK_NULL(out);
MAXENTMC_FWRITE(MAXENTMC_POWER_STREAM_HEADER,MAXENTMC_POWER_STREAM_HEADER_SIZE,out);
MAXENTMC_FWRITE(&(power->properties),sizeof(uint8_t),out);
max... |
functions | int maxentmc_power_print_product(struct maxentmc_power_struct const * const d, FILE * const out)
{
MAXENTMC_CHECK_NULL(d);
MAXENTMC_CHECK_NULL(out);
if(d->product){
size_t i;
for(i=0;i<d->size;++i){
struct maxentmc_product_link_struct entry = d->product->entry[i];
f... |
functions | int maxentmc_power_multiply_add(size_t const size,
struct maxentmc_power_struct const * const p1, maxentmc_index_t const x1_power_dim, maxentmc_float_t const * const * const x1,
struct maxentmc_power_struct const * const p2, maxentmc_index_t const x2_power... |
functions | else
for(i=0;i<p->size;++i){
size_t j;
struct maxentmc_product_link_struct const entry = p->product->entry[i];
for(j=0;j<entry.np;++j){
size_t const i1 = entry.p[j].i1;
size_t const i2 = entry.p[j... |
functions | else
for(i=0;i<p->size;++i){
size_t j;
struct maxentmc_product_link_struct const entry = p->product->entry[i];
for(j=0;j<entry.np;++j){
size_t const i1 = entry.p[j].i1;
size_t const i2 = entry.p[j... |
functions | else
for(i=0;i<p->size;++i){
size_t j;
struct maxentmc_product_link_struct const entry = p->product->entry[i];
for(j=0;j<entry.np;++j){
size_t const i1 = entry.p[j].i1;
size_t const i2 = entry.p[j... |
functions | else
for(i=0;i<p->size;++i){
size_t j;
struct maxentmc_product_link_struct const entry = p->product->entry[i];
for(j=0;j<entry.np;++j){
size_t const i1 = entry.p[j].i1;
size_t const i2 = entry.p[j... |
includes |
#include <stdio.h> |
includes | #include <stdlib.h> |
includes | #include <string.h> |
includes | #include <math.h> |
functions | void plugin_init (void)
{
addAtcommand("emotion",emotion);
} |
includes |
#include <assert.h> |
includes | #include <stdint.h> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.