xref: /haiku/src/add-ons/kernel/file_systems/ramfs/Misc.h (revision fc7456e9b1ec38c941134ed6d01c438cf289381e)
1 /*
2  * Copyright 2003, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * All rights reserved. Distributed under the terms of the MIT license.
4  */
5 #ifndef MISC_H
6 #define MISC_H
7 
8 #include <SupportDefs.h>
9 #include <util/StringHash.h>
10 
11 // min and max
12 // We don't want to include <algobase.h> otherwise we also get <iostream.h>
13 // and other undesired things.
14 template<typename C>
15 static inline C min(const C &a, const C &b) { return (a < b ? a : b); }
16 template<typename C>
17 static inline C max(const C &a, const C &b) { return (a > b ? a : b); }
18 
19 // node_child_hash
20 static inline
21 uint32
22 node_child_hash(uint64 id, const char *name)
23 {
24 	return uint32(id & 0xffffffff) ^ hash_hash_string(name);
25 }
26 
27 #endif	// MISC_H
28