카테고리 없음
.....
TaxosDevloper
2025. 4. 6. 20:20
## 코드와 주제
####tarr.h
```c
#pragma once
#ifndef TARR
#define TARR(NAME, T, L) struct NAME { T v[L]; }
#define EMPTY
#define ANONYMOUS_TARR_T(T, L) TARR(EMPTY, T, L)
#define ANONYMOUS_TARR(NAME, T, L) ANONYMOUS_TARR_T(T, L) NAME
#define CONCAT(X, Y) X##Y
#define __DEF_TARR_ISVAR__N typedef
#define __DEF_TARR_ISVAR__Y
#define DEF_TARR(IS_VAR, NAME, T, L) __DEF_TARR_ISVAR__##IS_VAR
#endif
```
####__2cppcore.h
```c
#pragma once
#ifdef ___2CPPCORE_H
#undef _2CPP
#else
#define ___2CPPCORE_H
#define _2CPP_START extern "C"
#define _2CPP_END }
#define __EMPTYF__(DUMMY)
#define __2CPPCORE__(SYMBOL) _2CPP##SYNBOL
#endif
#ifdef _cplusplus
#define _2CPP __2CPPCORE__
#else
#define _2CPP __EMPTYF__
#endif
```
####_2cpp.h
```c
#pragma once
#ifndef __2CPP_H
#define __2CPP_H
#include "__2cppcore.h"
#endif
```
####__coreof_tarrpp.h
```c
#pragma once
#ifndef __COREOF_TARRPP_H
#define __COREOF_TARRPP_H
#include "_2cpp.h"
_2CPP(START)
#include "tarr.h"
_2CPP(END)
#endif
```
####is_uint.h
```cpp
#pragma once
#ifndef _IS_UINT_H
#define _IS_UINT_H
#include <type_traits>
using is_uint = std::is_unsigned_v;
#endif
```
####uint.h
```cpp
#pragma once
#ifndef _UINT_H
#define _UINT_H
#include <concepts>
template <typename T>
concept uint = requires(is_uint<T>);
#endif
```
####uint.ixx
```cpp
export module uint;
#include "uint.h"
export is_uint;
export uint;
```
####uint_t.ixx
```cpp
export module uint_t;
import uint;
export uint::uint;
```
####tarrpp.h
```cpp
#pragma once
#ifndef _TARRPP_H
#define _TARRPP_H
#include "__coreof_tarrpp.h"
import uint_t;
namespace tarr {
//using c generical macro to wrap to c++
//N is just N₀ (whole number)
template <typename T, uint N, N L>
TARR(tarr, T, L);
template <typename T>
struct curredTARR {
template <uint N>
struct t {
template <N L, typename V = tarr::tarr<T, N, L>>
using t = V;
};
};
template <uint N>
struct MAXDepended {
template <typename T, N L, typename V = tarr::tarr<T, N, L>>
using tarr = V;
};
template <uint N, typename MAXDepended_t = tarr::MAXDepended<N>>
struct MAXDependedCurredTARR {
template <typename T>
struct t {
template <N L, typename V = MAXDepended_t::tarr<T, N>>
using t = V;
};
};
template <uint N, typename MAXDependedCurredTARR_C = tarr::MAXDependedCurredTARR<N>>
struct CurredLTARR {
template <N L>
struct t {
template <typename T, typename V = MAXDependedCurredTARR::t<T>::t<L>>
using t = V;
};
};
template <uint N, N L, typename LTARRER = tarr::CurredLTARR<N>::t<L>>
struct LTARR {
using ltarr_t = LTARRER::t;
};
};
#endif
```
### 주제 : 여기서 tarr의 `>>`, `<<`, `__builtin_rotateright32`, `__builtin_rotateleft32` 연산.
1. 어떻게 어셈블리가 이걸 처리하는가?
2. 하드웨어로 합성하면 어떨것인가 (특정 메모리 위치를 ROR • ROL • SHR • SHL하는 회로, 비트가 정해지고 -> 이동량이 정해지고 -> 영역이 정해지면 회로 작동이 어떨것인지 말이다.)