ログ

見る価値ありません

2020-12-01から1ヶ月間の記事一覧

アセンブリ言語で書いたサブルーチンをC言語から呼び出す

メモ str.h int strlen(const char*); str.asm global strlen section .text ; int strlen(const char*) strlen: xor rax, rax _L1: cmp [rdi], byte 0 jz _L2 inc rax inc rdi jmp _L1 _L2: ret test.c #include <stdio.h> #include <str.h> int main(void) { printf("%d\n"</str.h></stdio.h>…

ABC080 D - Recording

問題 atcoder.jp お気持ち 区間加算して最大値を求める問題 連続する区間は1つにするというところからxorを使いたくなる チャンネル数が少ないので整数型に収まる なのでxorでimos法をする コード fn main() { read_init!(buf); let (n, c): (usize, usize) …