diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-08-09 10:09:38 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-08-09 10:09:38 -0400 |
| commit | 35d3444e2742faa3c2e805cdcbfeceaf0287eefc (patch) | |
| tree | 408182308c5f962660f200c59b2619be8d194ffc /src/zig_llvm.cpp | |
| parent | 54675b060ae6139f60e111521b9a2688f66977a0 (diff) | |
| download | zig-35d3444e2742faa3c2e805cdcbfeceaf0287eefc.tar.gz zig-35d3444e2742faa3c2e805cdcbfeceaf0287eefc.zip | |
more intuitive left shift and right shift operators
Before:
* << is left shift, not allowed to shift 1 bits out
* <<% is left shift, allowed to shift 1 bits out
* >> is right shift, allowed to shift 1 bits out
After:
* << is left shift, allowed to shift 1 bits out
* >> is right shift, allowed to shift 1 bits out
* @shlExact is left shift, not allowed to shift 1 bits out
* @shrExact is right shift, not allowed to shift 1 bits out
Closes #413
Diffstat (limited to 'src/zig_llvm.cpp')
| -rw-r--r-- | src/zig_llvm.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index 1eeac98421..d9a35e4c4a 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -754,9 +754,22 @@ LLVMValueRef ZigLLVMBuildNSWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMVa LLVMValueRef ZigLLVMBuildNUWShl(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMValueRef RHS, const char *name) { - return wrap(unwrap(builder)->CreateShl(unwrap(LHS), unwrap(RHS), name, false, true)); + return wrap(unwrap(builder)->CreateShl(unwrap(LHS), unwrap(RHS), name, true, false)); +} + +LLVMValueRef ZigLLVMBuildLShrExact(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMValueRef RHS, + const char *name) +{ + return wrap(unwrap(builder)->CreateLShr(unwrap(LHS), unwrap(RHS), name, true)); } +LLVMValueRef ZigLLVMBuildAShrExact(LLVMBuilderRef builder, LLVMValueRef LHS, LLVMValueRef RHS, + const char *name) +{ + return wrap(unwrap(builder)->CreateAShr(unwrap(LHS), unwrap(RHS), name, true)); +} + + #include "buffer.hpp" bool ZigLLDLink(ZigLLVM_ObjectFormatType oformat, const char **args, size_t arg_count, Buf *diag_buf) { |
