aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorwatiko <service@mail.watiko.net>2016-01-15 15:06:12 +0900
committerwatiko <service@mail.watiko.net>2016-02-01 03:47:08 +0900
commita5f361e470c816ec9258fb815befafdef52b000b (patch)
treec35c74316b7a4f1a6aa486d41eaf9fae3b122f45 /src/nvim/ops.c
parent7fc996abf6151364ec045607a6e1ab51e32920e5 (diff)
downloadrneovim-a5f361e470c816ec9258fb815befafdef52b000b.tar.gz
rneovim-a5f361e470c816ec9258fb815befafdef52b000b.tar.bz2
rneovim-a5f361e470c816ec9258fb815befafdef52b000b.zip
vim-patch:7.4.1027
Problem: No support for binary numbers. Solution: Add "bin" to nrformats. (Jason Schulz) https://github.com/vim/vim/commit/887c1fea4a114e7170091942d0446c8882701b5b
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index e88d1d611c..c8894d6a91 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -4219,10 +4219,10 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
int c;
int length = 0; // character length of the number
int todel;
- int dohex;
- int dooct;
- int dobin;
- int doalp;
+ bool dohex;
+ bool dooct;
+ bool dobin;
+ bool doalp;
int firstdigit;
bool subtract;
bool negative = false;
@@ -4443,7 +4443,10 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
}
}
- vim_str2nr(ptr + col, &pre, &length, dobin, dooct, dohex,
+ vim_str2nr(ptr + col, &pre, &length,
+ 0 + (dobin ? STR2NR_BIN : 0)
+ + (dooct ? STR2NR_OCT : 0)
+ + (dohex ? STR2NR_HEX : 0),
NULL, &n, maxlen);
// ignore leading '-' for hex, octal and bin numbers
@@ -4540,8 +4543,10 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd)
size_t pos = 0;
// leading zeros
- for (bits = 8 * sizeof(unsigned long); bits > 0; bits--) {
- if ((n >> (bits - 1)) & 0x1) { break; }
+ for (bits = 8 * sizeof(n); bits > 0; bits--) {
+ if ((n >> (bits - 1)) & 0x1) {
+ break;
+ }
}
while (bits > 0) {