Skip to content

Instantly share code, notes, and snippets.

@uupaa
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save uupaa/6a9094089783e02c2218 to your computer and use it in GitHub Desktop.

Select an option

Save uupaa/6a9094089783e02c2218 to your computer and use it in GitHub Desktop.
getFreeSpace memo
// OK case
//
// line        = 0000,1111,1111,0000,0000,0000,0000,0000
// bits        = 1110,0000,0000,0000,0000,0000,0000,0000
//
// ------------------------------------------------------
// a           = 1110,1111,1111,0000,0000,0000,0000,0000 = line xor bits
// b           = 1110,1111,1111,0000,0000,0000,0000,0000 = line  or bits

if (a === b) { OK }

// NG CASE
// line        = 0000,1111,1111,1111,1111,1111,1111,1001
// bits        = 1111,1000,0000,0000,0000,0000,0000,0000
//
// ------------------------------------------------------
// a           = 1111,0111,1111,1111,1111,1111,1111,1001 = line xor bits
// b           = 1111,1111,1111,1111,1111,1111,1111,1001 = line  or bits
                      ^
if (a !== b) { NG }



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment