This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void remove_if ( node **head, node **rear, remove_fn rm ) | |
{ | |
for ( node **curr = head; *curr; ) { | |
node *entry = *curr; | |
if ( rm ( entry ) ) { | |
*curr = entry->next; | |
if ( *curr ) { | |
(*curr)->previous = entry->previous; | |
} else { // the rear node removed | |
*rear = entry->previous; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdbool.h> | |
#include "list.h" | |
Node *list_append(Node *list, void *data) { | |
if (list) list_last(&list); | |
Node *node = malloc(sizeof(Node)); | |
if (node) { | |
node->data = data; | |
node->next = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include "queue.h" | |
// Be careful! LIST_* are MACROS, NOT functions. No formal parameters! | |
typedef struct List { | |
int data; | |
LIST_ENTRY ( List ) linker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define IPL_DEPTH_1U 1 // 1位无符号整型(1bit) | |
#define IPL_DEPTH_8U 8 // 8位无符号整型(unsigned char) | |
#define IPL_DEPTH_16U 16 // 16位无符号整型 | |
#define IPL_DEPTH_32F 32 // 32位浮點 | |
#define IPL_DEPTH_8S (IPL_DEPTH_SIGN| 8) | |
#define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16) | |
#define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32) | |
typedef struct _IplImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
#include "queue.h" | |
typedef struct Node { | |
void *element; | |
LIST_ENTRY ( Node ) linker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://fighter1945.iteye.com/blog/1347732 | |
import web | |
from web import form as form | |
urls = ( | |
'/add/me/(.+)','add', | |
'/myadd','myadd' | |
) | |
class add: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void QuickSort(int *seq, const int begin, const int end) | |
{ | |
if (begin < end) { | |
int position = begin; // 选择起始元素作为划分参考 | |
int value = seq[position]; | |
for (int i = begin + 1; i < end; ++i) { | |
if (seq[i] < value) { | |
position++; | |
if (position != i) { | |
Swap(&seq[position], &seq[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Log level */ | |
#define X265_LOG_NONE (-1) | |
#define X265_LOG_ERROR 0 | |
#define X265_LOG_WARNING 1 | |
#define X265_LOG_INFO 2 | |
#define X265_LOG_DEBUG 3 | |
#define X265_LOG_FULL 4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://tinyhack.com/2014/03/12/implementing-a-web-server-in-a-single-printf-call/ | |
// http://blog.jobbole.com/64252/ | |
#include<stdio.h> | |
#include<string.h> | |
#include<stdlib.h> | |
#include<unistd.h> | |
#include<sys/types.h> | |
#include<sys/stat.h> | |
#include<sys/socket.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OpenCV: sumpixels.cpp | |
template<typename T, typename ST, typename QT> | |
void integral_( const T* src, size_t _srcstep, ST* sum, size_t _sumstep, | |
QT* sqsum, size_t _sqsumstep, ST* tilted, size_t _tiltedstep, | |
Size size, int cn ) | |
{ | |
int x, y, k; | |
int srcstep = (int)(_srcstep/sizeof(T)); |
OlderNewer