[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [MirageOS-devel] unsigned integers
hello, for several projects (i.e. sequence numbers) I had the need to have fixed width unsigned integers. Finally I managed to implement them (8, 16, 32, 64 bit), and would like to hear back from you what you think. The crucial bit for me is that arithmetic expression expose the carry bit explicitly (by being t -> t -> t * bool). I don't have the plan to complete it with all possible arithmetics operations (div, pow, ..), since I don't have use cases for these. The type t is on purpose a public alias to (int, int, int32, int64), thus you can use bit operations from these modules directly (and, xor, or). This also means that you have interoperability with e.g. cstruct. The documentation is up at https://hannesm.github.io/usane/doc/Usane.html , code at https://github.com/hannesm/usane The implementation uses __builtin_add/sub/mul_overflow if available (since clang 3.4 / gcc 5.1). Please let me know what you think, hannes _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |