xref: /haiku/src/add-ons/kernel/file_systems/ramfs/Misc.h (revision 3be79a33b059ba22f25c7db93743b758717d8b68)
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 
10 #include "String.h"
11 
12 // min and max
13 // We don't want to include <algobase.h> otherwise we also get <iostream.h>
14 // and other undesired things.
15 template<typename C>
16 static inline C min(const C &a, const C &b) { return (a < b ? a : b); }
17 template<typename C>
18 static inline C max(const C &a, const C &b) { return (a > b ? a : b); }
19 
20 // node_child_hash
21 static inline
22 uint32
23 node_child_hash(uint64 id, const char *name)
24 {
25 	return uint32(id & 0xffffffff) ^ string_hash(name);
26 }
27 
28 #endif	// MISC_H
29