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
/* Minimum and maximum values a ‘signed int’ can hold. */ | |
#define INT_MAX 2147483647 | |
#define INT_MIN (-INT_MAX - 1) |
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
int dcomp = (-2147483648 < 0); | |
int hcomp = (0x80000000 < 0); |
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
int dtmin = -2147483648; | |
int dcomp2 = (dtmin < 0); | |
int htmin = 0x80000000; | |
int hcomp2 = (htmin < 0); |
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
/* WARNING: This code is buggy */ | |
/* Shift 1 over by 8*sizeof(long) - 1 */ | |
1L << sizeof(long)<<3 - 1 |
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
/* Shift 1 over by 8*sizeof(long) - 1 */ | |
1L << (sizeof(long)<<3) - 1 |
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 <algorithm> | |
#include <ctime> | |
#include <iostream> | |
int main() | |
{ | |
// Generate data | |
const unsigned arraySize = 32768; | |
int data[arraySize]; |
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
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]; |
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> | |
#define IDENT 1 | |
#define OPER * | |
typedef int data_t; | |
typedef struct { | |
int len; | |
data_t *data; |
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
for( i = 0; i < length; i++) | |
x = x OPER data[i]; | |
*dest = x; |
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
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 |
OlderNewer