k06a
|
codepad
|
|
k06a
|
Saved pastes by k06a:
// Copyright 2013 (c) Anton Bukov - https://github.com/k06a
// Inspired by http://graphics.stanford.edu/~seander/bithacks.html
#define P0(a) (a)
#define P1(a) (((P0(a) & 0x55555555) << 1) | ((P0(a) & 0xAAAAAAAA) >> 1))
|
view (20 lines, 1 line of output) |
template<typename R, typename F>
class WhereRange
{
WhereRange(R r, F & f)
: r(r), f(f)
|
view (41 lines) |
#include <map>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
|
view (55 lines, 20 lines of output) |
#include <map>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
|
view (52 lines, 9 lines of output) |
#include <map>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
|
view (51 lines, 87 lines of output) |
// Karatsuba multiplication LE+BE (+undef) (only 3 mul!)
#include <stdlib.h>
#include <iostream>
|
view (138 lines, 1 line of output) |
// Bit_iterator demonstration fixed
#include <iostream>
#include <fstream>
#include <iterator>
|
view (71 lines, 1 line of output) |
// LittleBigEndian.h fixed for 64-bits added union
//
#ifndef LITTLEBIGENDIAN_H
#define LITTLEBIGENDIAN_H
|
view (251 lines, 2 lines of output, 1 comment) |
// Bit_iterator demonstration
#include <iostream>
#include <fstream>
#include <iterator>
|
view (56 lines, 1 line of output) |
// LittleBigEndian.h fixed for 64-bits added union
//
#ifndef LITTLEBIGENDIAN_H
#define LITTLEBIGENDIAN_H
|
view (258 lines, 2 lines of output) |
// LittleBigEndian.h fixed for 64-bits
//
#ifndef LITTLEBIGENDIAN_H
#define LITTLEBIGENDIAN_H
|
view (252 lines, 2 lines of output) |
//
// Interfaces grouping (with combinations) concept demonstration
//
// ------------------------------------------------
|
view (171 lines, 3 lines of output) |
//
// Interfaces grouping concept demonstration
//
// ------------------------------------------------
|
view (135 lines, 3 lines of output) |
#include <iostream>
using namespace std;
bool isValidHorseMove(const char * m) // "A1-B3"
|
view (70 lines, 3 lines of output) |
#include <iostream>
using namespace std;
bool isValidHorseMove(const char * m) // "A1-B3"
|
view (59 lines, 2 lines of output) |
int main()
{
printf("0x%x\n", (unsigned int)"hello 1");
printf("0x%x\n", (unsigned int)"hello 2");
printf("0x%x\n", (unsigned int)"hello 1");
|
view (7 lines, 4 lines of output, 1 comment) |
void MainWindow::on_pushButton_options_clicked()
{
if (ui->groupBox_options->isVisible())
{
ui->groupBox_options->setVisible(false);
|
view (10 lines, 2 comments) |
#include <iostream>
using namespace std;
// ------------------------------------------------
|
view (73 lines) |
#include <iostream>
using namespace std;
// ------------------------------------------------
|
view (66 lines, 5 lines of output, 2 comments) |
#include <windows.h>
#include <iostream>
const int ARRAY_LENGTH = 10;
const int NUM_OF_THREADS = 10;
|
view (50 lines) |
// C#
// search array "item" in array "buffer"
private int findSubArray(byte[] buffer, byte[] str)
{
for (int i = 0; i < buffer.Length; i++)
|
view (16 lines) |
ip_addr getStructByIp(QString value)
{
QStringList list = value.split(".", QString::SkipEmptyParts);
ip_addr ip;
|
view (24 lines) |
ip_addr getStructByIp(QString value)
{
QStringList list = value.split(".", QString::SkipEmptyParts);
ip_addr ip;
|
view (15 lines) |
int main()
{
// Указатель на начало пакета
char *ptr = "227 Entering Passive Mode (195,114,128,23,255,127)";
|
view (32 lines, 1 line of output, 1 comment) |
#include <iostream>
// Generate first value
#define generateFirstValue(n,k) ( ((1 << k) - 1) << (n - k) )
|
view (73 lines, 15 lines of output) |
; В регистр DX необходимо положить
; эквивалент расстояния до точки.
; Вычисляем: (ax*ax)+(cx*cx)
push ax
push bx
|
view (18 lines, 10 comments) |