Skip to content

Instantly share code, notes, and snippets.

View lichenbo's full-sized avatar
🏠
Working from home

Chenbo Li lichenbo

🏠
Working from home
View GitHub Profile
/* Minimum and maximum values a ‘signed int’ can hold. */
#define INT_MAX 2147483647
#define INT_MIN (-INT_MAX - 1)
int dcomp = (-2147483648 < 0);
int hcomp = (0x80000000 < 0);
int dtmin = -2147483648;
int dcomp2 = (dtmin < 0);
int htmin = 0x80000000;
int hcomp2 = (htmin < 0);
/* WARNING: This code is buggy */
/* Shift 1 over by 8*sizeof(long) - 1 */
1L << sizeof(long)<<3 - 1
/* Shift 1 over by 8*sizeof(long) - 1 */
1L << (sizeof(long)<<3) - 1
#include <algorithm>
#include <ctime>
#include <iostream>
int main()
{
// Generate data
const unsigned arraySize = 32768;
int data[arraySize];
import java.util.Arrays;
import java.util.Random;
public class Main
{
public static void main(String[] args)
{
// Generate data
int arraySize = 32768;
int data[] = new int[arraySize];
#include <stdio.h>
#include <stdlib.h>
#define IDENT 1
#define OPER *
typedef int data_t;
typedef struct {
int len;
data_t *data;
for( i = 0; i < length; i++)
x = x OPER data[i];
*dest = x;
00401488 mov -0x4(%ebp),%eax
0040148B shl $0x2,%eax
0040148E add -0x10(%ebp),%eax
00401491 mov (%eax),%eax
00401493 mov -0x8(%ebp),%edx
00401496 imul %edx,%eax
00401499 mov %eax,-0x8(%ebp)
0040149C incl -0x4(%ebp)
0040149F mov -0x4(%ebp),%eax
004014A2 cmp -0xc(%ebp),%eax