Skip to contentSkip to conversation

remove redundant AND from swp_type

PATCH New Marcelo Tosatti 1 participant 1 message Oct 8, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove redundant AND from swp_type

Hi,

There is a useless AND in swp_type() function.

We just shifted right SWP_TYPE_SHIFT() bits the value from the swp_entry_t, and then we AND it with "(1 << 5) - 1" (which is a mask corresponding to the number of bits used by "type").

Remove it since its redundant.

This is probably some leftover from old code.

include/linux/swapops.h +1 -2
@@ -30,8 +30,7 @@
  */
 static inline unsigned swp_type(swp_entry_t entry)
 {
-	return (entry.val >> SWP_TYPE_SHIFT(entry)) &
-			((1 << MAX_SWAPFILES_SHIFT) - 1);
+	return (entry.val >> SWP_TYPE_SHIFT(entry));
 }
 
 /*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>