Faiss
 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 CC-by-NC license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 // Copyright 2004-present Facebook. All Rights Reserved.
10 #pragma once
11 
12 namespace faiss { namespace gpu {
13 
14 template <typename T>
15 inline __device__ void swap(bool swap, T& x, T& y) {
16  T tmp = x;
17  x = swap ? y : x;
18  y = swap ? tmp : y;
19 }
20 
21 template <typename T>
22 inline __device__ void assign(bool assign, T& x, T y) {
23  x = assign ? y : x;
24 }
25 
26 } } // namespace