Skip to content

Instantly share code, notes, and snippets.

View gist:933d622b37cf468f9c4d
define i32 @main() {
%buf = alloca i8, i32 24, align 16
%r = call i32 @llvm.eh.sjlj.setjmp(i8* %buf)
;%r = add i32 0, 1
%normal = icmp eq i32 %r, 0
br i1 %normal, label %Normal, label %Jump
Normal:
View gist:b9871f4bddab05803199
contract PerformanceTester {
function ackermann(uint m, uint n) returns (uint) {
if (m == 0)
return n + 1;
if (n == 0)
return ackermann(m - 1, 1);
return ackermann(m - 1, ackermann(m, n - 1));
}
@chfast
chfast / shift.ll
Last active Aug 29, 2015
LLVM shift test
View shift.ll
; RUN: opt < %s -constprop -S | FileCheck %s
; CHECK-LABEL: shift_undef_65
define void @shift_undef_65(i65* %p) {
%r1 = lshr i65 2, 18446744073709551617
; CHECK: store i65 undef, %p
store i65 %r1, i65* %p
%r2 = ashr i65 4, 18446744073709551617
; CHECK: store i65 undef, %p
View context.cpp
// Copyright Oliver Kowalke 2009.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <cstdlib>
#include <cstring>
#include <iostream>
@chfast
chfast / bt
Created Jun 12, 2015
Assertion `_peer->m_asking == Asking::Nothing' failed
View bt
alethzero: /home/chfast/Projects/ethereum/cpp-ethereum/libethereum/EthereumHost.cpp:621: void dev::eth::EthereumHost::continueSync(dev::eth::EthereumPeer*): Assertion `_peer->m_asking == Asking::Nothing' failed.
[New Thread 0x7fff377f5700 (LWP 14688)]
[New Thread 0x7fff2cffc700 (LWP 14690)]
[New Thread 0x7fff36bf4700 (LWP 14689)]
[New Thread 0x7fff457fa700 (LWP 14680)]
[New Thread 0x7fff45ffb700 (LWP 14679)]
[New Thread 0x7fff467fc700 (LWP 14678)]
[New Thread 0x7fff46ffd700 (LWP 14677)]
[New Thread 0x7fff477fe700 (LWP 14676)]
[New Thread 0x7fff47fff700 (LWP 14675)]
View cmake.log
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
View build.log
Scanning dependencies of target alethzero_automoc
[ 0%] Automatic moc and uic for target alethzero
Generating ui_AlethZero.h
Generating ui_Connect.h
Generating ui_AllAccounts.h
Generating ui_BrainWallet.h
Generating ui_ImportKey.h
Generating ui_NewAccount.h
Generating ui_BlockList.h
Generating ui_ExportState.h
@chfast
chfast / boost-div.cpp
Created Sep 13, 2015
boost multiprecision div bug test case
View boost-div.cpp
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/version.hpp>
using u256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;
int main()
{
std::cout << "Boost " << BOOST_VERSION << std::endl;
View BankOfDeposit.sol
// Bank Of Deposit
//
// This contract keeps user's ethers in its internal storage. This approach
// allows cheaper batch transfers than series of individual Ethereum
// transactions.
contract BankOfDeposit {
// OPT: solidity additionally hashes the key of the map what in case of
// address is a waste of gas
mapping(address => uint) _balance;
View Timestamping.sol
contract Timestamping {
mapping(bytes32 => uint256) stamps;
function Timestamping() {
set_stamp("hello world");
}
function set_stamp(bytes32 hash) {
stamps[hash] = block.timestamp;