好久没写nonsense了。
进行近期的记忆备份。
device tree source 与 device tree binary 相互转换
安装device-tree-compiler工具
dts转dtb dtc -I dts -O dtb *.dtb *.dts
dtb转dts dtc -I dtb -O dts *.dts *.dtb
研究 RISC-V vlse 指令学习了 C++ ptrdiff_t类型。
一句话介绍:
std::ptrdiff_t is used for pointer arithmetic and array indexing, if negative values are possible.
possible implementation:
// valid since C++11
using ptrdiff_t = decltype(static_cast<int*>(nullptr) - static_cast<int*>(nullptr));
example:
#include <cstddef>
#include <iostream>
int main()
{
const std::size_t N = 10;
int* a = new int[N];
int* end = a + N;
for (std::ptrdiff_t i = N; i > 0; --i)
std::cout << (*(end - i) = i) << ' ';
std::cout << '\n';
delete[] a;
}
Output:
10 9 8 7 6 5 4 3 2 1
顺便学习了 size_t竟然是有符号的。