Re: [ovs-dev] [patch v9 05/11] ovs-atomic: Add 64 bit apis.

2018-12-10 Thread Darrell Ball
On Mon, Dec 10, 2018 at 5:50 PM Ben Pfaff  wrote:

> On Mon, Nov 19, 2018 at 11:09:24AM -0800, Darrell Ball wrote:
> > Signed-off-by: Darrell Ball 
>
> Please write 1ull as 1ULL because in some fonts the former is almost
> unreadable.
>

Makes sense



>
> Thanks,
>
> Ben.
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [patch v9 05/11] ovs-atomic: Add 64 bit apis.

2018-12-10 Thread Ben Pfaff
On Mon, Nov 19, 2018 at 11:09:24AM -0800, Darrell Ball wrote:
> Signed-off-by: Darrell Ball 

Please write 1ull as 1ULL because in some fonts the former is almost
unreadable.

Thanks,

Ben.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [patch v9 05/11] ovs-atomic: Add 64 bit apis.

2018-11-19 Thread Darrell Ball
Signed-off-by: Darrell Ball 
---
 lib/ovs-atomic.h | 36 
 1 file changed, 36 insertions(+)

diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h
index 4664eef..19b49c8 100644
--- a/lib/ovs-atomic.h
+++ b/lib/ovs-atomic.h
@@ -479,6 +479,42 @@ atomic_count_set(atomic_count *count, unsigned int value)
 atomic_store_relaxed(>count, value);
 }
 
+static inline uint64_t
+atomic_count_inc64(atomic_uint64_t *counter)
+{
+uint64_t old;
+
+atomic_add_relaxed(counter, 1ull, );
+
+return old;
+}
+
+static inline uint64_t
+atomic_count_dec64(atomic_uint64_t *counter)
+{
+uint64_t old;
+
+atomic_sub_relaxed(counter, 1ull, );
+
+return old;
+}
+
+static inline uint64_t
+atomic_count_get64(atomic_uint64_t *counter)
+{
+uint64_t value;
+
+atomic_read_relaxed(counter, );
+
+return value;
+}
+
+static inline void
+atomic_count_set64(atomic_uint64_t *counter, uint64_t value)
+{
+atomic_store_relaxed(counter, value);
+}
+
 /* Reference count. */
 struct ovs_refcount {
 atomic_uint count;
-- 
1.9.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev