aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/eval/wrap_param.h
blob: 7717a82a5828970770927be57941960f292b40eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

namespace vespalib::eval::tensor_function {

template <typename T, typename IN> uint64_t wrap_param(const IN &value_in) {
    const T &value = value_in;
    static_assert(sizeof(uint64_t) == sizeof(&value));
    return (uint64_t)&value;
}

template <typename T> const T &unwrap_param(uint64_t param) {
    return *((const T *)param);
}

} // namespace