Faiss

- Main Page
- Namespaces
- Classes
- Files

- File List

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
MergeNetworkUtils.cuh
1 /**
2 * Copyright (c) 2015-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD+Patents license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9 #pragma once
10
11 namespace faiss { namespace gpu {
12
13 template <typename T>
14 inline __device__ void swap(bool swap, T& x, T& y) {
15 T tmp = x;
16 x = swap ? y : x;
17 y = swap ? tmp : y;
18 }
19
20 template <typename T>
21 inline __device__ void assign(bool assign, T& x, T y) {
22 x = assign ? y : x;
23 }
24
25 } } // namespace