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
| uint32_t read_id_isar5(void) { | |
| uint32_t value; | |
| asm volatile("mrc p15, 0, %0, c0, c2, 5" : "=r"(value)); | |
| return value; | |
| } | |
| void check_crypto_extension(void) { | |
| uint32_t id_isar5 = read_id_isar5(); | |
| uint32_t aes = (id_isar5 >> 4) & 0xF; |
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
| // clang -fomit-frame-pointer -target arm-linux-gnueabihf -march=armv8-a -mcpu=cortex-a53 -mfloat-abi=hard -marm | |
| // --sysroot=/usr/lib/arm-linux-gnueabihf test.c | |
| // のようにomit-frame-pointerを指定していても、オプション指定なし(O0)だと以下のように怒られる。 | |
| // test.c:12:9: warning: inline asm clobber list contains reserved registers: R11 [-Winline-asm] | |
| // 12 | "sub sp, sp, #0x200\n\t" | |
| // | ^ | |
| // test.c:12:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour. | |
| // 1 warning generated. | |
| // O1以上を指定すると出ない。 |
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
| #define DEBUG_WOLFSSL | |
| // | |
| #define HAVE_CURVE25519 | |
| #define WOLFSSL_SHA512 | |
| #define HAVE_ED25519 | |
| #define WOLFSSL_SP_MATH_ALL | |
| #include <windows.h> |
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
| (custom-set-variables | |
| ;; custom-set-variables was added by Custom. | |
| ;; If you edit it by hand, you could mess it up, so be careful. | |
| ;; Your init file should contain only one such instance. | |
| ;; If there is more than one, they won't work right. | |
| '(custom-enabled-themes '(wheatgrass))) | |
| (custom-set-faces | |
| ;; custom-set-faces was added by Custom. | |
| ;; If you edit it by hand, you could mess it up, so be careful. |
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
| import numpy as np | |
| import my_ext | |
| a = np.arange(0, 8, dtype=np.uint8).reshape(4, 2) | |
| my_ext.inspect(a) | |
| print("--------\n") | |
| my_ext.prepare() | |
| b = my_ext.calc(a) |
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
| import hashlib | |
| import itertools | |
| from colorsys import hls_to_rgb | |
| import numpy as np | |
| from PIL import Image, ImageShow | |
| INPUT = "1430311" | |
| PIXEL = 70 # 1ピクセルのサイズ |
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
| // https://maguro.dev/debug-macro/ | |
| macro_rules! debug { | |
| ($($a:expr),* $(,)*) => { | |
| #[cfg(debug_assertions)] | |
| eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*); | |
| }; | |
| } | |
| // https://kuretchi.hateblo.jp/entry/rust_nested_vec | |
| macro_rules! nested_vec { |
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
| // http://staryoshi.hatenablog.com/entry/2015/10/27/173925 | |
| #include <iostream> | |
| #include <memory> | |
| class Any { | |
| private: | |
| struct base { | |
| virtual std::type_info const& type() const { return typeid(nullptr); } | |
| virtual std::unique_ptr<base> clone() const { return nullptr; } | |
| }; |
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
| /* | |
| Copyright 2020 Patrick Fruh | |
| This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation, either version 2 of the License, or | |
| (at your option) any later version. | |
| This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
| from functools import partial | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from scipy.integrate import solve_ivp | |
| def U(r): | |
| return 0.5 * r ** 3 |
NewerOlder