I'm thinking, type of 'number' in vim script must be 64bit. Also 'float' should be 'double' in 2013/2014 or later.
`getfsize()` can't return size of big file over 32bit. And localtime() return 32bit.
I suggest to let us convert types in vim script.
How do you think?
Thanks.
This is in progress.
I think that supporting 64-bit Number (even on 32-bit systems) is very useful.
One of the best examples is getfsize() as mattn said. 32-bit Number is too
small to represent a filesize nowadays.
2014/1/6 Mon 15:34:44 UTC+9 mattn wrote:
> https://gist.github.com/mattn/8278843
>
> This is in progress.
I have updated mattn's patch:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/fd966d51f56b69e02d9ebb984355f692b73b2260/num64.patch?at=default&fileviewer=file-view-default
Changes are:
* Sync with the latest codebase.
* VC9 or earlier doesn't have stdint.h, int64_t and uint64_t.
Use __int64 for old Windows compilers.
* Define FEAT_NUM64 in feature.h.
(If someone doesn't like this feature, s/he can disable this by editing
feature.h.)
* Display +/-num64 in :version.
* Add has('num64').
* Adjust the behaviour when dividing by 0. (:help expr-/)
* Adjust the behaviour of float2nr().
I confirmed that getfsize() returned a right value even if the filesize was
over 2 GiB. (My largefile patches are also needed.)
I also confirmed that all existing tests passed.
Of cause, more tests are needed, and documents should be updated.
(See also: [patch] Always use long for vimscript Numbers
https://groups.google.com/d/topic/vim_dev/Ju0DDCqeuMc/discussion )
Regards,
Ken Takata
I have updated the patch and divided it into two:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/ec8fa710e76975724c30d0f84c02e1460e5bb705/num64.patch?at=default&fileviewer=file-view-default
https://bitbucket.org/k_takata/vim-ktakata-mq/src/ec8fa710e76975724c30d0f84c02e1460e5bb705/incdec64.patch?at=default&fileviewer=file-view-default
If incdec64.patch is applied, incrementing/decrementing with <C-A>/<C-X> uses
64-bit integer on supported platforms. (Currently, 64-bit int is used on 64-bit
Linux but not on 64-bit Windows.)
Regards,
Ken Takata
I have updated the paches:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/d1b6fe7c1f38ffc8d7fda03fda31d0dec6a5cbd1/num64.patch?fileviewer=file-view-default
https://bitbucket.org/k_takata/vim-ktakata-mq/src/d1b6fe7c1f38ffc8d7fda03fda31d0dec6a5cbd1/incdec64.patch?fileviewer=file-view-default
Now, vim_snprintf() supports 64-bit formats (%lld, etc.).
Regards,
Ken Takata
Here are the updated num64 patches for 7.4.1202 (including docs).
Also available on my bitbucket repository:
https://bitbucket.org/k_takata/vim-ktakata-mq/src
Regards,
Ken Takata
I have updated the num64 patch. I have merged the three patches into one again.
This includes the fix of the g<C-G> problem:
https://groups.google.com/d/msg/vim_dev/8epHlRuIAHc/j5I9x9eHEQAJ
Regards,
Ken Takata
2016/2/24 Wed 22:10:33 UTC+9 Ken Takata wrote:
> I have updated the num64 patch. I have merged the three patches into one again.
> This includes the fix of the g<C-G> problem:
> https://groups.google.com/d/msg/vim_dev/8epHlRuIAHc/j5I9x9eHEQAJ
I have updated the num64 patch for 7.4.1665.
Please check the attached patch.
Bram, I'm afraid that you are mistaking some of my patches.
Attached patch is related to the following item from the todo.txt:
L175-176
> Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
> Also in update of Feb 24?
The num64 patch is also available from the following URL:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/tip/num64.patch
(I will keep it up to date in the same URL.)
Regards,
Ken Takata
2016/3/29 Tue 2:27:40 UTC+9 Bram Moolenaar wrote:
> Ken Takata wrote:
>
> > 2016/2/24 Wed 22:10:33 UTC+9 Ken Takata wrote:
> > > I have updated the num64 patch. I have merged the three patches into one again.
> > > This includes the fix of the g<C-G> problem:
> > > https://groups.google.com/d/msg/vim_dev/8epHlRuIAHc/j5I9x9eHEQAJ
> >
> > I have updated the num64 patch for 7.4.1665.
> > Please check the attached patch.
> >
> > Bram, I'm afraid that you are mistaking some of my patches.
> > Attached patch is related to the following item from the todo.txt:
> >
> > L175-176
> > > Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
> > > Also in update of Feb 24?
> >
> > The num64 patch is also available from the following URL:
> > https://bitbucket.org/k_takata/vim-ktakata-mq/src/tip/num64.patch
> > (I will keep it up to date in the same URL.)
>
> Thanks. Hopefully I get to including it one of these days.
I have slightly updated the num64 patch.
I changed to use vim_snprintf() instead of sprintf() when a 64-bit number is
used, and removed VARNUMBER_FMT. I think this makes the source codes a bit
easier to understand. E.g.:
Before:
sprintf((char *)buf, "%"VARNUMBER_FMT"d",
(varnumber_T)varp->vval.v_number);
After:
vim_snprintf((char *)buf, NUMBUFLEN, "%lld",
(varnumber_T)varp->vval.v_number);
Regards,
Ken Takata
I have updated the num64 patch. Now it includes some tests.
While I wrote the tests, I found some bugs, but they are already fixed.
I also added type casts to suppress warnings.
Please check the attached patch. The same patch is also available at:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/tip/num64.patch
Regards,
Ken Takata