aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/method_index.h
blob: 6539fd3a3d7b5dd05c9afc75c6a14fa450a556c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include <util/system/platform.h>
#include <cstring>
#include <cstdint>

namespace NYql {

size_t GetMethodPtrIndex(uintptr_t ptr);

template<typename Method>
inline size_t GetMethodIndex(Method method) {
    uintptr_t ptr;
    std::memcpy(&ptr, &method, sizeof(uintptr_t));
    return GetMethodPtrIndex(ptr);
}

template<typename Method>
inline uintptr_t GetMethodPtr(Method method) {
    uintptr_t ptr;
    std::memcpy(&ptr, &method, sizeof(uintptr_t));
    return ptr;
}

}