alias dtype = DType.int16
@value
struct Position(KeyElement):
var x: SIMD[dtype, 1]
var y: SIMD[dtype, 1]
var data: SIMD[dtype, 2]
var hash: Int
fn __init__(inout self, x: SIMD[dtype, 1], y: SIMD[dtype, 1]):
self.x = x
self.y = y
self.data = SIMD[dtype, 2](self.x, self.y)
self.hash = hash(self.data)
fn __hash__(self) -> Int:
return self.hash
fn __eq__(self, other: Self) -> Bool:
return self.hash == other.hash
fn __ne__(self, other: Self) -> Bool:
return self.hash != other.hash
fn __str__(self) -> String:
return str(self.data)
fn __len__(self) -> Int:
return len(self.data)
alias dtype = DType.int16
@value
struct Position(KeyElement):
var x: SIMD[dtype, 1]
var y: SIMD[dtype, 1]
var data: SIMD[dtype, 2]
var hash: Int
fn __init__(inout self, x: SIMD[dtype, 1], y: SIMD[dtype, 1]):
self.x = x
self.y = y
self.data = SIMD[dtype, 2](self.x, self.y)
self.hash = hash(self.data)
fn __hash__(self) -> Int:
return self.hash
fn __eq__(self, other: Self) -> Bool:
return self.hash == other.hash
fn __ne__(self, other: Self) -> Bool:
return self.hash != other.hash
fn __str__(self) -> String:
return str(self.data)
fn __len__(self) -> Int:
return len(self.data)