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