Subversion Repositories HelenOS-historic

Rev

Rev 627 | Rev 1104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 627 Rev 1024
Line 36... Line 36...
36
/** Atomic addition.
36
/** Atomic addition.
37
 *
37
 *
38
 * @param val Atomic value.
38
 * @param val Atomic value.
39
 * @param imm Value to add.
39
 * @param imm Value to add.
40
 *
40
 *
41
 * @return Value after addition.
41
 * @return Value before addition.
42
 */
42
 */
43
static inline count_t atomic_add(atomic_t *val, int imm)
43
static inline count_t atomic_add(atomic_t *val, int imm)
44
{
44
{
45
    count_t v;
45
    count_t v;
46
 
46
 
Line 60... Line 60...
60
}
60
}
61
 
61
 
62
static inline void atomic_inc(atomic_t *val) { atomic_add(val, 1); }
62
static inline void atomic_inc(atomic_t *val) { atomic_add(val, 1); }
63
static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
63
static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
64
 
64
 
65
static inline count_t atomic_inc_pre(atomic_t *val) { return atomic_add(val, 1); }
65
static inline count_t atomic_preinc(atomic_t *val) { return atomic_add(val, 1) + 1; }
66
static inline count_t atomic_dec_pre(atomic_t *val) { return atomic_add(val, -1); }
66
static inline count_t atomic_predec(atomic_t *val) { return atomic_add(val, -1) - 1; }
67
 
67
 
68
static inline count_t atomic_inc_post(atomic_t *val) { return atomic_add(val, 1) + 1; }
68
static inline count_t atomic_postinc(atomic_t *val) { return atomic_add(val, 1); }
69
static inline count_t atomic_dec_post(atomic_t *val) { return atomic_add(val, -1) - 1; }
69
static inline count_t atomic_postdec(atomic_t *val) { return atomic_add(val, -1); }
70
 
70
 
71
#endif
71
#endif