Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Leap-year/WebAssembly/leap-year-1.wasm
Normal file
14
Task/Leap-year/WebAssembly/leap-year-1.wasm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(module
|
||||
;; function isLeapYear: returns 1 if its argument (e.g. 2004) is a leap year, 0 otherwise.
|
||||
;; Returns year%4==0 and (year%100!=0 or year%400==0)
|
||||
(func $isLeapYear (param $year i32) (result i32)
|
||||
(i32.and
|
||||
(i32.eqz (i32.rem_u (get_local $year) (i32.const 4))) ;; year%4 == 0
|
||||
(i32.or
|
||||
(i32.ne (i32.rem_u (get_local $year) (i32.const 100)) (i32.const 0)) ;; year%100 != 0
|
||||
(i32.eqz (i32.rem_u (get_local $year) (i32.const 400))) ;; yaer%400 == 0
|
||||
)
|
||||
)
|
||||
)
|
||||
(export "isLeapYear" (func $isLeapYear))
|
||||
)
|
||||
22
Task/Leap-year/WebAssembly/leap-year-2.wasm
Normal file
22
Task/Leap-year/WebAssembly/leap-year-2.wasm
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(module
|
||||
;; function isLeapYear: returns 1 if its argument (e.g. 2004) is a leap year, 0 otherwise.
|
||||
;; Returns year%4==0 and (year%100!=0 or year%400==0)
|
||||
(func $isLeapYear (param $year i32) (result i32)
|
||||
get_local $year
|
||||
i32.const 4
|
||||
i32.rem_u
|
||||
i32.eqz ;; year % 4 == 0
|
||||
get_local $year
|
||||
i32.const 100
|
||||
i32.rem_u
|
||||
i32.const 0
|
||||
i32.ne ;; year % 100 != 0
|
||||
get_local $year
|
||||
i32.const 400
|
||||
i32.rem_u
|
||||
i32.eqz ;; year % 400 == 0
|
||||
i32.or
|
||||
i32.and
|
||||
)
|
||||
(export "isLeapYear" (func $isLeapYear))
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue