diff --git a/CLI/Reduce.cpp b/CLI/Reduce.cpp index 38133e04..721bb51c 100644 --- a/CLI/Reduce.cpp +++ b/CLI/Reduce.cpp @@ -15,7 +15,7 @@ #define VERBOSE 0 // 1 - print out commandline invocations. 2 - print out stdout -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) const auto popen = &_popen; const auto pclose = &_pclose; diff --git a/VM/src/lmem.cpp b/VM/src/lmem.cpp index 3cbdafff..25ca999d 100644 --- a/VM/src/lmem.cpp +++ b/VM/src/lmem.cpp @@ -98,6 +98,8 @@ */ #if defined(__APPLE__) #define ABISWITCH(x64, ms32, gcc32) (sizeof(void*) == 8 ? x64 : gcc32) +#elif defined(__i386__) && defined(__MINGW32__) && !defined(__MINGW64__) +#define ABISWITCH(x64, ms32, gcc32) (ms32) #elif defined(__i386__) && !defined(_MSC_VER) #define ABISWITCH(x64, ms32, gcc32) (gcc32) #else diff --git a/docs/_pages/compatibility.md b/docs/_pages/compatibility.md index b57a9af6..94f8809b 100644 --- a/docs/_pages/compatibility.md +++ b/docs/_pages/compatibility.md @@ -87,7 +87,7 @@ Ephemeron tables may be implemented at some point since they do have valid uses | bitwise operators | ❌ | `bit32` library covers this in absence of 64-bit integers | | basic utf-8 support | ✔️ | we include `utf8` library and other UTF8 features | | functions for packing and unpacking values (string.pack/unpack/packsize) | ✔️ | | -| floor division | 🔜 | | +| floor division | ✔️ | | | `ipairs` and the `table` library respect metamethods | ❌ | no strong use cases, performance implications | | new function `table.move` | ✔️ | | | `collectgarbage("count")` now returns only one result | ✔️ | | diff --git a/docs/_pages/syntax.md b/docs/_pages/syntax.md index 595a4804..42fbf897 100644 --- a/docs/_pages/syntax.md +++ b/docs/_pages/syntax.md @@ -273,3 +273,9 @@ This restriction is made to prevent developers using other programming languages Luau currently does not support backtick string literals as a type annotation, so `` type Foo = `Foo` `` is invalid. Function calls with a backtick string literal without parenthesis is not supported, so `` print`hello` `` is invalid. + +## Floor division (`//`) + +Luau implements support for floor division operator (`//`) for numbers as well as support for `__idiv` metamethod. The syntax and semantics follow [Lua 5.3](https://www.lua.org/manual/5.3/manual.html#3.4.1). + +For numbers, `a // b` is equal to `math.floor(a / b)`; when `b` is 0, `a // b` results in infinity or NaN as appropriate. diff --git a/rfcs/syntax-floor-division-operator.md b/rfcs/syntax-floor-division-operator.md index 8ec3913f..b84ddd18 100644 --- a/rfcs/syntax-floor-division-operator.md +++ b/rfcs/syntax-floor-division-operator.md @@ -1,5 +1,7 @@ # Floor division operator +**Status**: Implemented + ## Summary Add floor division operator `//` to ease computing with integers.