Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value swap macro change with xor #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -767,11 +767,11 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }


/*
* swap - swap value of @a and @b
* swap - swap value of @a and @b using xor
*/
#define swap(a, b) \
do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)

(((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
Expand Down