Talk:Set right-adjacent bits: Difference between revisions

From Rosetta Code
Content added Content deleted
(More Interesting Way)
 
Line 1: Line 1:
==More Interesting Way==
==More Interesting Way==
Copy the input to result, then for bits to set right shift input 1 and or with result.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 17:06, 20 December 2021 (UTC)
Copy the input to result, then for bits to set right shift input 1 and or with result.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 17:06, 20 December 2021 (UTC)

:That's essentially the first two Python solutions or-ing the input shifted zero to n times. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 18:48, 20 December 2021 (UTC)

Revision as of 18:49, 20 December 2021

More Interesting Way

Copy the input to result, then for bits to set right shift input 1 and or with result.--Nigel Galloway (talk) 17:06, 20 December 2021 (UTC)

That's essentially the first two Python solutions or-ing the input shifted zero to n times. --Paddy3118 (talk) 18:48, 20 December 2021 (UTC)