Skip to content

Instantly share code, notes, and snippets.

View H2CO3's full-sized avatar
🦀

Árpád Goretity  H2CO3

🦀
View GitHub Profile
use std::io;
use std::io::{Read, BufRead, BufReader};
use std::cmp::{min, max};
use std::collections::HashMap;
struct Testcase {
sum_price: u64,
flavor_prices: Vec<u64>,
}
fn take_mut_ref(ptr: &mut i32) {
*ptr += 1;
}
fn main() {
let mut x = 42;
{
let ptr = &mut x;
take_mut_ref(ptr);
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
static int twocomp(unsigned u)
{
if (u > INT_MAX) {
return (long long)u - (long long)UINT_MAX - 1LL;
} else {
1. utasítás: | 2. utasítás:
|
PC[-2] PC[0] PC[2] |
+-------+--------+--------+-------+--------+--------+
| "ADD" | 0x12ab | 0x2468 | "SUB" | 0x2345 | 0x3456 |
+-------+--------+--------+-------+--------+--------+
^ ^ ^ ^
+ PC-2 | +- PC+2 +- PC+4 stb.
|
PC = 0xf00
.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 10, 11
.globl _main
.align 4, 0x90
_main: ## @main
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp0:
.cfi_def_cfa_offset 16
#include <stdio.h>
#include <spn/ctx.h>
typedef struct {
SpnContext *ctx;
SpnFunction *fn;
SpnValue arg;
} CallbackData;
#include <vector>
#include <array>
#include <cstdio>
#include <iostream>
#include <random>
enum State: unsigned char {
Empty,
X,
@H2CO3
H2CO3 / pc.cc
Created February 29, 2016 22:20
// cloud must be sorted beforehand
size_t num_rows = 10;
size_t num_cols = 10;
size_t min_x = … // find from cloud
size_t max_x = … // find from cloud
size_t dx = (max_x - min_x) / num_rows;
size_t min_y = … // find from cloud
override func llvmType() -> LLVMTypeRef {
// a function with a 'Void' argument is a
// special case: it means '0 arguments'.
var args: [LLVMTypeRef] = []
if self.argType != VoidType() {
args.append(self.argType.llvmType())
}
return LLVMFunctionType(
self.retType.llvmType(),
$ swift tree.swift
tree.swift:1:8: error: recursive value type 'Node' is not allowed
struct Node {
^
0 swift 0x000000010248933b llvm::sys::PrintStackTrace(__sFILE*) + 43
1 swift 0x0000000102489a7b SignalHandler(int) + 379
2 libsystem_platform.dylib 0x00007fff95d1bf1a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff5f689e20 _sigtramp + 3382107936
4 swift 0x000000010067889b swift::irgen::TypeConverter::convertAnyNominalType(swift::CanType, swift::NominalTypeDecl*) + 379
5 swift 0x0000000100678295 swift::irgen::TypeConverter::convertType(swift::CanType) + 181