This file contains hidden or 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
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>, | |
} |
This file contains hidden or 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
fn take_mut_ref(ptr: &mut i32) { | |
*ptr += 1; | |
} | |
fn main() { | |
let mut x = 42; | |
{ | |
let ptr = &mut x; | |
take_mut_ref(ptr); |
This file contains hidden or 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> | |
#include <limits.h> | |
static int twocomp(unsigned u) | |
{ | |
if (u > INT_MAX) { | |
return (long long)u - (long long)UINT_MAX - 1LL; | |
} else { |
This file contains hidden or 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
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 |
This file contains hidden or 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
.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 |
This file contains hidden or 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 <spn/ctx.h> | |
typedef struct { | |
SpnContext *ctx; | |
SpnFunction *fn; | |
SpnValue arg; | |
} CallbackData; |
This file contains hidden or 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 <vector> | |
#include <array> | |
#include <cstdio> | |
#include <iostream> | |
#include <random> | |
enum State: unsigned char { | |
Empty, | |
X, |
This file contains hidden or 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
// 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 |
This file contains hidden or 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
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(), |
This file contains hidden or 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
$ 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 |